0% found this document useful (0 votes)
4 views

Lab 2 c

The document outlines a lab assignment for a Computer Science course at the University of Engineering and Technology, Lahore, focusing on C++ programming tasks. It includes five questions requiring the design of various classes such as Book, Triangle, personal data holder, widget manufacturing plant, and Date, each with specific functionalities and input validation criteria. Each task is graded with a maximum of 2 marks, contributing to the overall learning outcome (CLO-1).
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lab 2 c

The document outlines a lab assignment for a Computer Science course at the University of Engineering and Technology, Lahore, focusing on C++ programming tasks. It includes five questions requiring the design of various classes such as Book, Triangle, personal data holder, widget manufacturing plant, and Date, each with specific functionalities and input validation criteria. Each task is graded with a maximum of 2 marks, contributing to the overall learning outcome (CLO-1).
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Department of Computer Science, New Campus

UNIVERSITY OF ENGINEERING
AND TECHNOLOGY, LAHORE

Lab: 2 Target CLO-1


Rubrics
CLO 1 2 3 4 5
CLO-1 2-marks for 2-marks for 2-marks for 2-marks for 2-marks for
task1 task2 task3 task4 task5

Question: 1
Write C++ code that defines a Book class comprising private member variables for title,
author, and publication year. Display the information of 5 books.

Question: 2
Write C++ code, in which a Triangle class is declared, featuring private attributes for base and
height. Public member function calculateArea. And display the area of triangle.

Question: 3
Design a class that holds the following personal data: name, address, age, and phone
number. Write appropriate info function. Creates three instances of it. One instance should
hold your information, and the other two should hold your friends’ or family members’
information.

Question: 4
Design a class for a widget manufacturing plant. If 10 widgets may be produced each hour,
the class object will calculate how many days it will take to produce any number of widgets.
(The plant operates two shifts of eight hours each per day.) Write a program that asks the
user for the number of widgets that have been ordered and then displays the number of
days it will take to produce them. Hint: widgetsPerDay = widgetsPerHour * hoursPerShift *
shiftsPerDay.

Question: 5
Design a class called Date. The class should store a date in three integers: month, day, and
year. There should be member functions to print the date in the following forms:

• 12/25/10
• December 25, 2010
• 25 December 2010
Demonstrate the class by writing a complete program and implementing it.
Department of Computer Science, New Campus
UNIVERSITY OF ENGINEERING
AND TECHNOLOGY, LAHORE

Input Validation: Do not accept values for the day greater than 31 or less than 1. Do not
accept values for the month greater than 12 or less than 1.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy