Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Q1. Create a class grocery to calculate the purchase bill. (Assume that this s/w caters for at the max 5 items in the
bill)
Member variables :
Items[] – names of five items.
RATE[] – per unit rate of five items. (can be in decimals)
Qty[] – Quantity purchased of each item. (Can be in decimals)
Bill amount - Net Bill amount after giving the discount .
Discount of decimal type
Member Methods :
i. intput( ) : To accept the various values
ii float calcdisc(float ) : To calculate the discount on the bill amount
iii void calcbill( ) : To calculate the bill
iii void display( ) : To display the final bill in the following format
Q2. Read a list of numbers in a terminal window and display sum of even and odd numbers.
Q3.
a. Sum= ½ + 1/3 + ¼ ….. 1/n
b. 1
12
123
Q4. Display a menu with the following options
1. Prime number check
2. Palindrome number check
3. Exit
Depending on the choice do the needful
Q5. Read an array of 5 integers in a terminal window and display the same.
Project 2 – Geometry
Q1. Define a class Point to model in the X-Y plane. Define a function to translate a point along the X and Y axis
respectively. Define a function that calculate the distance from the other point.
Member functions :
Deci2bin( int n) It will convert decimal number to its binary equivalent
Bin2Deci(int a) will convert binary number a to its decimal equivalent
KmtoM(int k) will convert kilometers to meters
MtoKm(int m) will convert Meters to Kilo meters
HourstoMin(int h) will convert hours to minutes
MintoHrs(int min) will convert minutes to hours
FeettoInches(int f) will convert feet to inches
Inchestofeet(int i) will convert inches to feet
Create another class which has main function, and use all the above functions.
Q2. Read a list of numbers in a terminal window and display count of positive and negative numbers.
Q3.
a. Sum= ½ + 2/3 + 3/4 ….. n/n+1
b. 1
2 2
3 3 3
Q4. Display a menu with the following options
1. HCF
2. Reduce to a smaller fraction
3. Exit
Depending on the choice do the needful
Q5. Read an array of 5 integers in a terminal window and display the same.
Project 5 – Water Bill Calculation
Create another class which has main function, and use all the above functions.
Q2. Read a list of numbers in a terminal window and display count of even and odd numbers.
Q3.
a. Sum= ½! + 2/4! + 3/6! ….. n
b. 1
2 2
3 3 3
2 2
1
Q4. Display a menu with the following options
1. addition
2. subtraction
3. Exit
Depending on the choice do the needful
Q5. Read an array of 5 integers in a terminal window and display the same.
Project 7 – Temperature Conversion
Q1.Create a class Conversion to do the various temperature conversions. The member functions should be as
follows:
Create another class which has main function, and uses all the above functions.
Q2. Read a list of numbers in a terminal window and display count of positive and negative numbers.
Q3.
a. Sum= ½! + 1/4! + 1/6! ….. n
b.
7531
753
75
7
Q4. Display a menu with the following options
1. Reverse a string
2. Palindrome check of a string
3. Exit
Depending on the choice do the needful
Q5. Read an array of 5 integers in a terminal window and display the same.
Project 8 – Payroll
Write another class, and create main( ) function and use the above functions to calculate the salary of any
employee.
Create another class which has main function, and uses all the above functions.
Q2. Read sides of a triangle in a terminal window and display the type of the triangle.
Q3.
a. Sum= ½! + 2/4! + 3/6! ….. n
b.
7654321
765432
76543
7654
765
76
7
Q4. Display a menu with the following options
1. Two strings are equal or not
2. Display length of a string
3. Exit
Depending on the choice do the needful
Q5. Read an array of 5 integers in a terminal window and display the same.
Project 9 – Income Tax
Q1.
Problem Description : To calculate the Income Tax of an employee .
Member functions
shares( ) constructor to initialize the object
shares(String , int , int ) constructor to initialize the object
void buy( int no) reads number of shares to be bought and make changes in member variables
void sell( int no ) reads number of shares to be bought and make changes in member variables
calc( ) to calculate the total value of shares
show( ) to show the details.
Note : buy( ) and sell( ) functions will increase or decrease the number of shares, and accordingly the Total value
of shares should be changed.
Create another class and write main( ) function and use the above functions.
Q2. Read length and breadth in a terminal window and display area of a rectangle.
Q3.
a. Sum= x!/2! + x!/4! + x!/6! ….. n
b.
1
23
456
Q1. Problem Description : To calculate the number of days passed till date in the current year.
Member functions
date( ) constructor to initialize the object
date(int d, int m ) constructor to initialize the object
countdays( ) to count the number of days from 1st Jan of the current year.
Create another class and write main( ) function and use the above functions.
2. Read length, breadth and height in a terminal window and display volume of a cuboid.
Q3.
a. Sum= x!/2! - x!/4! + x!/6! –x!/8!….. n
b.
1
23
456
Member functions
date( ) constructor to initialize the object
date(int d, int m) constructor to initialize the object
void timeOfDay( ) based on the time you have to show whether it is Morning/AfterNon/Evening/Night
void incrs_time(int mnts) Increase the time by mnts minutes.
time diff(time t1) Find out the difference of two times and return it to the calling function.
Create another class and write main( ) function and use the above functions.
2. Read two numbers in a terminal window and display the greater number.
Q3.
a. Sum= 1/12 +2/22 +3/32+n/n2
b.
1
35
7 9 11
Create another class and write main( ) function and use the above functions.
Project 14 – Electric Heater
Data members :
temperature - integer field
min - possible minimum temperature setting
max - possible maximum temperature setting
Member functions :
heater( ) set the temperature to 20 degree
heat( ) , cool( ) functions to increase or decrease the temperature by 5 degree
Take care of min & max temperature settings.
temp( ) function to return the current temperature.
2. Read three numbers in a terminal window and display the greatest number.
Q3.
a. Sum= 1/12 +3/22 +5/32+.. n
b.
1
2 3
4 5 6
Class Use_calculator
Write a main method which creates an object of the above class and call all the methods.
2. Read a number in a terminal window and display even or odd.
Q3.
a. Sum= 1/12 +3/22 +5/32+…..n
b.
1
35
7 9 11
2. Read two numbers in a terminal window and display the greater number.
Q3.
a. Sum= 1/12 +2/22 +3/32+n/n2
b.
1
35
7 9 11
Q1. Computer Science Project on diagnosing diseases (Heart problem and cancer)
Class : diagnose2
Member Variables:
//store the diseases and symptoms through parameterized constructor
Id(patient id), Name(patient name),
disease1=”heart problem”, disease2=”cancer”,
Symptomd1(array)( 1st Symptom for disease 1), symptomd12(Second symptom for disease 1),symptomd13(Third
symptom for disease 1)
Symptomd2(array)( 1st Symptom for disease 2), symptomd22( 2nd Symptom for disease 2), symptomd23( 3rd
Symptom for disease 2) (store all the symptoms), disease_detected
Functions used :
Default constructor
Parameterized constructor
void new_diagnose( int , String) // Function to create a new patiens( id and name to be accepted)
void ask() // function to ask symptoms and decide the disease and calls the display_details()
private void display_details( )// Function to display the remedies for the detected disease
String return_disease( ) // To return the disease
String return_name()//To return the name
Class Usediagnose2
Write a main method which creates an object of the above class and call all the methods.
Q2. Read two numbers and an operator(+,-,*,/) in a terminal window and display the result accordingly.
For example if the numbers are 4 and 5 and the operator is + then the result should be 9.
Q3.
c. Sum= x/2! + x/4! + x/6! ….. n
d.
1111
2222
Q2. Read a list of numbers in a terminal window and display count of positive and negative numbers.
Q3.
a. Sum= ½ + 2/3 + 3/4 ….. n/n+1
b. 1
2 2
3 3 3
Q4. Display a menu with the following options
1. HCF
2. Reduce to a smaller fraction
3. Exit
Depending on the choice do the needful
Q5. Read an array of 5 integers in a terminal window and display the same.
Project 24 – Banking