1. Write a program that asks the user for a height in inches and prints out how many feet and inches that is. There are 12 inches in one foot. For instance, 40 inches is 3 feet and 4 inches. [Hint: use the // operator and the % operator to get each part.]
Q2: Write a program to overload operators in the same program by writing suitable operator member
functions for following expression:
07= ((01 % 02)>(03 || 04) - (05>06)) [Here 01,02,03,04,05,06 and 07 are objects of a class
"overloading", and this class is having one integer data member]
Q4: Discuss constructors with default arguments and constructor overloading with the help of suitable
examples.
Q2: Write a program to overload operators in the same program by writing suitable operator memb
functions for following expression:
07= ((01 % 02)(03 || 04) - (05>06)) [Here 01,02,03,04,05,06 and 07 are objects of a cla
"overloading", and this class is having one integer data member]
Explain the type of constrcuors with the examples.
Create a class called Point which will have 2 co-ordinate value x & y and will be able to
calculate the distance between two points. Write appropriate constructor and method of the class.
Create another class called Shape, which takes different number of points to create a triangle,
rectangle and circle. And also able to calculate the area and perimeter for the different shapes.
Write the appropriate overloading method for this shape class. Write appropriate main function to
test the shape class.
Create the class Matrics on size m*n. Define the all matrices operations like addition,
subtraction and multiplication on Matrics type objects. Use operator overloading
A file contains a list of telephone number in following form.(10 Marks)
Aman 9915336423
Raj 9915336429
….. ……….
Assume 10 such entries. ( Each students entry should be different)
Name contains only one word and name and telephone number are separated by 5 white spaces.
i) Write a program to read the file and output the list in two columns. Name should be left justified
and number should be right justified.
ii) Write a program that will create the data file containing the list of telephone number given in
above form. Use a class object to store each set of data.
iii) Write a interactive menu driven program that will access the file created in first part and implement
the following task.
a) Determine the telephone number of specific person.
b) Determine the name if a telephone number is known.
c) Update the telephone number when there is a change in telephone number
Explain what is meant by the syntax and the semantics of a programming language. Give Java examples to illustrate the difference between a syntax error and a semantics error. Use different examples than those found in the textbook.
1. Do people really need technology in their lives? Is it really a necessity?
2. How do you reconcile the ‘need’ for technology and the dilemma/s it faces?
3. Should there be an ethics of technology?