1. Write a pseudocode to find the perimeter and area of a rectangle
The perimeter and area of the rectangle are given by the following formulas:
perimeter = 2 * (length + width)
area = length * width
1.PROMPT user to enter length and width
2.READ length and width
3. CALCULATE perimeter and area
perimeter = 2 * (length + width)
area = length * width
area = length * width
4. OUTPUT perimeter and area
2. Write a pseudocode which inputs a length in inches, and outputs its equivalent in centimeters (1 inch = 2.54 centimeters)
1.PROMPT user to enter inch
2.READ inch
3. CONVERT inch into centimeters
centimeters = inch * 2.54
4. OUTPUT centimeters
Now, its your turn -write a pseudocode for the following problems.
1.(Converting feet into meters) Write a program
that reads a number in feet, converts it to meters, and displays the
result. One foot is 0.305 meters.
2.*(Calculating tips) Write a program that
reads the subtotal and the gratuity rate, and computes the gratuity and
total. For example, if the user enters 10 for subtotal and 15% for
gratuity rate, the program displays $1.5 as gratuity and $11.5 as total.
3.*(Payroll) Write a program that reads the following information and prints a payroll statement:
Employee's name (e.g., Smith)
Number of hours worked in a week (e.g., 10)
Hourly pay rate (e.g., 6.75)
Federal tax withholding rate (e.g., 20%)
State tax withholding rate (e.g., 9%)
A sample run of a program is shown in below:-
The level of difficulty is rated as easy (no star), moderate (*), hard (**), or challenging (***).
No comments:
Post a Comment