Anda di halaman 1dari 2

UCS-305 Lab Assignment 1

1. WAP in C++to print Welcome to the revolution of object oriented paradigm


2. WAP in C++to display the following output
OOP=90
MP=76
DCF=67
3. WAP in C++ to evaluate the following expression x=a/b-c where a, b ,c are imputed from the
keyboard .
4. WAP in C++ to convert temperature in Fahrenheit to Celsius using the class temp.
5. WAP in C++ that generates the Pascal triangle.
6. WAP in C++ factorial of given number using the class fact.
7. WAP in C++ to Fibonacci series using class.
8. WAP in C++ to detect weather the number is Armstrong or not.
9. WAP in C++ to check the weather the string is palindrome or not.
10. Write a program that computes and displays the area of a triangle, after the user has entered its
height and base.
11. Write a program that inputs an integer number and displays its absolute value (i.e., if the input
value is negative then the value would be displayed as positive and if the input value is positive or 0
then the output should coincide with the input. For example, if the input is 3 the output value will
be 3).
12. Students in SUB were surveyed about how many days a week they eat fast-food.
Write a program to help analyze the result of the survey. Initially the program prompts how many
input values there are, it then reads in the specified number of values, and counts how many
answers is 0 day a week, 1 day a week, etc. Finally the result is displayed in a table, each row
showing the number of days, the number of students that eat fast-food that many days a week, and
what percentage they constitute of the total number of students surveyed. An example running
session might look like follows (you dont have to align the table columns):
How many input values are there: 5
Enter number of days: 2
Enter number of days: 0
Enter number of days: 3
Enter number of days: 3
Enter number of days: 7
Days

Students

0
1
2
3
4
5
6
7

1
0
1
2
0
0
0
1

Percentage
(%)
20
0
20
40
0
0
0
20

13. WAP to enter the information of the student using the class student.

UCS-305 Lab Assignment 2


IMPLEMENT THE FOLLOWING 5 PROGRAMS IN C ( using STRUCTURES )
AND IN C++ USING CLASSES
1.

Create class employee.WAP to enter the information of employee and display the
information
Consider the following data members: Name, address, department, wages And following method
Getdata( ),putdata( ),putwages( ).

2. WAP in C++to compute and display the salary of employee.


Basic=10,000, DA=51% and HRA=15% of basic using the manipulator setw and endl to
display the write justify result.
3. Write a program that reads in 10 numbers and displays their average, and the largest of the
numbers (assume that all the inputs are positive integers).
4. Write a program that prompts for students final grades in a given class (the grades are integer
values in the range 1-9). The program then displays the class grade average, the highest grade,
and how many students in the class failed the course (a grade less than 4 is a failing grade). If
more than 10 students failed the course a message Fail is displayed at the very end. An
illegitimate input value for grade is used to indicate that there are no more students grades to be
entered. An example running session looks as follow:
Enter students grade: 8
Enter students grade: 7
Enter students grade: 3
Enter students grade: 5
Enter students grade: 3
Enter students grade: -1
Class average: 5.2
Highest grade: 8
Number of students that failed the course: 2
5. Write a program that prompts the user to enter 5 exam marks (design your program such
that it would be easy to change if we wanted it to work for more than 5 exams). The program
then displays the average mark, the highest mark, and number of marks entered less than the
average mark. For example, when executing the program and inputting 20, 30, 10, 40, and 50
the running session will look as follows:
Enter a mark: 20
Enter a mark: 30
Enter a mark: 10
Enter a mark: 40
Enter a mark: 50
Average mark is: 30.0
Highest mark is: 50
Number of marks less than the average: 2

Anda mungkin juga menyukai