You are on page 1of 4

Course Manual

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 # % & 10

ITEM NAME Mouse Printer Hard disc Scanner Ram e!"oard Scro$$ Mouse Monitor Modem Com'uter ta"$e

COST PRICE 100 2000 3000 2500 1500 #50 500 6000 1250 25&&

TAX 4%

DISCNT 10%

FINAL PIRICE

PROFIT

Calculation Method Final price= Sale Price !iscount Pro"it= Final price #Cost Price $ax% &. Create a database called student in Microso"t 'ccess and create a table ha(ing "ields student id) student name) marks "or di""erent sub*ects. Set student id as primar+ ke+. ,nsert records using Microso"t 'ccess. -. .sing Microso"t PowerPoint prepare a seminar presentation. .se design template "or slides. /. 0rite a program to con(ert Fahrenheit temperature to Celsius Fahrenheit=1.12Celsius+-& 3. ' "i(e digit positi(e integer is gi(en. ,t is re4uired to "ind the sum o" indi(idual digits. For example i" the gi(en number is 56173 the re4uired sum is 5+6+1+7+3=-3. 0rite a C++ program "or the abo(e problem

n=56173 digit81=n91:=5617391:=3 n=n;1:=56173;1:=5617 digit8&=n91:=561791:=7 n=n;1:=5617;1:=561 digit8-=n91:=56191:=1 n=n;1:=561;1:=56 digit8/=n91:=5691:=6 n=n;1:=56;1:=5 digit83=5 Sum=digit81+digit8&+digit8-+digit8/+digit83 6. <i(en a 3 digit integer write a c++ program to print it in re(erse order =ogic is same as the abo(e problem digit=n91: re(8dgit=re(8digit+digit21: n=n;1: 7. 0rite a C++ program to read the radius o" the circle and compute its area and perimeter. ,nput= Enter the radius o" the circle >utput= Print area and perimeter 1. 0rite a program to "ind the rupee e4ui(alent o" .S dollars using the exchange rate to nearest 3: paisa. For example i" x=/&.&3 and exchange rate is ?s.-1.16 pr dollar the answer should be ?upees 1-17 paisa 3:. 5. .sing conditional statement write a program to pick the largest o" - numbers. 1:. >btain decision tables "or simulating an automatic stamp wending machine with the "ollowing speci"ications. ,t should dispense 1) & and 3 rupee stamps ,t should accept 1) &) 3 rupee coins ,t can accept not more than one coin "or each transaction

," more than one coin o" the same denomination is to be returned as change a"ter dispensing the stamp) the machine cannot do it. ,nstead the coin should be returned and no change signal turned on. 0rite a program to simulate the machine. $he input o" the program would be amount tendered and stamp re4uested. $he output o" the program should be whether the stamp is dispensed or not) the (alue o" the stamp dispensed) the denomination o" the coin returned #i" an+% and no change signal i" no change is returned and no stamp i" the stamp is not a(ailable. 11. 0rite a class person that would contain basic in"ormation such as name) birth date and address. !eri(e class student "rom person. 1&. 0rite a class triangle that inherits "rom shape. ,t needs to ha(e a constructer and destructor "unction to get the rele(ant in"ormation o" triangle. 'lso it should ha(e its own area# % member "unction 1-. 0rite a program in C++ to add two complex numbers using "riend "unction 1/. ' bank account consists o" two kinds o" accounts "or customers are called as sa(ings account and the other as current account. $he sa(ing account pro(ides compound interest and withdrawal "acilit+ but no che4ue book "acilit+. $he current account pro(ides che4ue book "acilit+ but no interest. Current account holders should also maintain a minimum balance and i" the balance "alls below this le(el a ser(ice charge is imposed. Create a class account that stores customer name) account number and t+pe o" account. "rom this deri(e the classes current account and sa(ings account to make them more speci"ic to their re4uirements a% 'ccept deposit "rom the customer and update the balance b% !ispla+ the balance c% Compute and deposit interest d% Permit withdrawal and update the balance e% Check "or the minimum balance. ,mpose penalt+ i" necessar+ and update the balance. .se member "unction to initiali@e the ob*ects 13. .sing C++ write a program to accept rollno) mark1) mark&) mark- and sa(e it to a "ile. 0hene(er the user enters the roll number ) the details o" the students should be displa+ed 16. >(erload the operator 2 in class string. Find the expression s2k that will be a string which means k copies the string s String operator2#int n%

17. Create a base class shape which uses a (irtual "unction called area. !eri(e two classes triangle and rectangle "rom the class shape and "ind the area using the concept Pol+morphism. class Shape A PublicB Cirtual double area # % =:D ED !eri(e a class "rom shape class ?ectangle B public shape A Pri(ateB double height) width PublicB double area# % A return # height2 width%E E

You might also like