Raya University
Collage of Engineering and Technology
Department of Computer Science
Computer Programming- Group Assignment out of 40%
For 1st year Computer Science students
General Instruction:
➢ Write your program as clear as possible, use comments when necessary
➢ Plagiarism is totally forbidden
➢ Submission media type: handwritten paper
Question 1: Write a complete C++ program starting from the #include<iostream> header that
displays the following menu on the screen and performs all the tasks listed below: [20 pts]
Simple Calculator
========================
Press 1: to Calculate the Volume of a Sphere
Press 2: to Calculate the Area of a Rectangle
Press 3: to Calculate the Area of a Triangle
Press 4: to Calculate the sum of two numbers
Press 5: to Calculate the multiplication of two numbers
Press 6: to Terminate (Quit) the program
========================
Enter your choice (1-6)
• If the user enters 1, the program should ask for the radius of the sphere and then display
its volume. Use 3.14159 for PI.
Comp2042-Group Assignment (40%) Due date: _____/_____/13 ~1~
• If the user enters 2, the program should ask for the length and width of the rectangle, and
then display the rectangle’s area.
• If the user enters 3 the program should ask for the length of the triangle’s base and its
height, and then display its area.
• If the user enters 4 the program should ask the user to enter any two numbers from the
keyboard and displays the sum of the two numbers
• If the user enters 5 the program should ask the user to enter any two numbers from the
keyboard and displays the multiplication of the two numbers
• If the user enters 6, the program should terminate (quit).
Question 2: Write a complete C++ Program using while loop that asks the user to enter any number
‘N’ from the keyboard to finds the reverse of the number and add 10 to the number and then
display the result on the screen.
for example, if the input is 125, the output should be 531, that is 521+10 and if the input is 34,
the output should be 53, that is 43+10. [5 pts]
Question 3: Write a complete C++ program using for loop that asks the user to enter a number
‘N’, from the keyboard and then prints all even squares between 1 and 2n. [5 pts]
for example, if the user enters 40, the program should print the following:
16
36
64
Q 4: What is the difference between inline functions and normal functions? write an interactive
program with an inline function for finding the maximum value of two numbers. [3 pts]
Q 5: What is infinite loop mean? Write at most 3 examples of infinite loops using for loop. [4 pts]
Q 6: What are arrays? Explain how they simplify programming with a suitable example?. [3 pts]
Comp2042-Group Assignment (40%) Due date: _____/_____/13 ~2~