Course Manual: Class S3MN
Course Manual: Class S3MN
Class S3MN Subject: Computer Programming & Application Lab Total Contact Hours: 24 C++ Exercises 1. Create worksheet as shown below using the calculation method shown in the table
Computer Parts PROFIT SALE 25% PRICE
SNO 1 2 3 4 5 6 7 8 9 10
ITEM NAME Mouse Printer Hard disc Scanner Ram Keyboard Scroll Mouse Monitor Modem Computer table
COST PRICE 100 2000 3000 2500 1500 750 500 6000 1250 2599
TAX 4%
DISCNT 10%
FINAL PIRICE
PROFIT
Calculation Method Final price= Sale Price- Discount Profit= Final price-(Cost Price-Tax) 2. Create a database called student in Microsoft Access and create a table having fields student id, student name, marks for different subjects. Set student id as primary key. Insert records using Microsoft Access. Using Microsoft PowerPoint prepare a seminar presentation. Use design template for slides. Write a program to convert Fahrenheit temperature to Celsius Fahrenheit=1.8*Celsius+32 5. A five digit positive integer is given. It is required to find the sum of individual digits. For example if the given number is 96875 the required sum is 9+6+8+7+5=35. Write a C++ program for the above problem
3. 4.
n=96875 digit_1=n%10=96875%10=5 n=n/10=96875/10=9687 digit_2=n%10=9687%10=7 n=n/10=9687/10=968 digit_3=n%10=968%10=8 n=n/10=968/10=96 digit_4=n%10=96%10=6 n=n/10=96/10=9 digit_5=9 Sum=digit_1+digit_2+digit_3+digit_4+digit_5 6. Given a 5 digit integer write a c++ program to print it in reverse order Logic is same as the above problem digit=n%10 rev_dgit=rev_digit+digit*10 n=n/10 Write a C++ program to read the radius of the circle and compute its area and perimeter. Input= Enter the radius of the circle Output= Print area and perimeter 8. Write a program to find the rupee equivalent of US dollars using the exchange rate to nearest 50 paisa. For example if x=42.25 and exchange rate is Rs.31.16 pr dollar the answer should be Rupees 1317 paisa 50. 9. Using conditional statement write a program to pick the largest of 3 numbers.
7.
10. Obtain decision tables for simulating an automatic stamp wending machine with the following specifications. It should dispense 1, 2 and 5 rupee stamps It should accept 1, 2, 5 rupee coins It can accept not more than one coin for each transaction
If more than one coin of the same denomination is to be returned as change after dispensing the stamp, the machine cannot do it. Instead the coin should be returned and no change signal turned on. Write a program to simulate the machine. The input of the program would be amount tendered and stamp requested. The output of the program should be whether the stamp is dispensed or not, the value of the stamp dispensed, the denomination of the coin returned (if any) and no change signal if no change is returned and no stamp if the stamp is not available. 11. Write a class person that would contain basic information such as name, birth date and address. Derive class student from person. 12. Write a class triangle that inherits from shape. It needs to have a constructer and destructor function to get the relevant information of triangle. Also it should have its own area( ) member function 13. Write a program in C++ to add two complex numbers using friend function
14. A bank account consists of two kinds of accounts for customers are called as savings account and the other as current account. The saving account provides compound interest and withdrawal facility but no cheque book facility. The current account provides cheque book facility but no interest. Current account holders should also maintain a minimum balance and if the balance falls below this level a service charge is imposed. Create a class account that stores customer name, account number and type of account. from this derive the classes current account and savings account to make them more specific to their requirements a) Accept deposit from the customer and update the balance b) Display the balance c) Compute and deposit interest d) Permit withdrawal and update the balance e) Check for the minimum balance. Impose penalty if necessary and update the balance. Use member function to initialize the objects 15. Using C++ write a program to accept rollno, mark1, mark2, mark3 and save it to a file. Whenever the user enters the roll number , the details of the students should be displayed 16. Overload the operator * in class string. Find the expression s*k that will be a string which means k copies the string s String operator*(int n)
17. Create a base class shape which uses a virtual function called area. Derive two classes triangle and rectangle from the class shape and find the area using the concept Polymorphism. class Shape { Public: Virtual double area ( ) =0; }; Derive a class from shape class Rectangle : public shape { Private: double height, width Public: double area( ) { return ( height* width)} }