Write a program to work with rectangles. The following main menu must be repeated until ‘0’ (zero) is entered.

computer science

Description

1.        Write a program to work with rectangles. The following main menu must be repeated until ‘0’ (zero) is entered. When the first or second menu is selected, the program will ask for the value via a message such as “Enter the length:”, assign the value to the variable, and display the confirmation message such as “The length is set at: 10”. When the third menu is selected, the program will display a message such as “The area of a 10 x 20 rectangle is: 200.” If the user enters any other number, the program should display a message such as “Invalid input. Try again.”

 

Menu

1: To set and display the length
2: To set and display the width
3: To display the area

0: To exit the program

Enter a number:

 

2.        Write a program that assigns a letter grade to every student in a class. The number of the students must be specified by the user. For each student, assume that all the four scores entered by the user are out of 100 points, so you will have to convert them. The program will display both the total percentage and the corresponding letter grade of one student at a time; then, the program will also display an option whether the user wants to exit the program or continue to the next student (e.g. Type ‘Y’ to exit the program or ‘N’ to continue to the next student). However, the program must quit if it reaches the last student. Be sure to provide well-formatted messages at every step.

 

2 Homework

40%

2 Exams

60%

TOTAL  

100%

A = 90% and above

B = 80% - 89%

C = 70% - 79%

D = 60% - 69%

F =   0% - 59%

 

        The converting formula:   

 


Related Questions in computer science category