Design and implement a program compute volume of a cylinder


Programming and Problem Solving Lab Assignment: Type Systems and Expressions

Program 1: Design (pseudocode) and implement (source code) a program (name it Cylinder) to compute the volume of a cylinder using the following formulas (PI is 3.14):

Area= radius * radius * PI
Volume = area * length

The program reads the radius and length from the user and then computes the volume. Document your code and properly label the input prompts and the outputs as shown below.

Sample run 1:

Enter radius:5.5
Entered length:12
The Volume is1139.82

Sample run 2:

Enter radius:1.0
Entered length:1.0
The Volume is3.14

Sample run 3:

Enter radius:6.5
Entered length:10.0
The Volume is1326.65

Program 2: Design (pseudocode) and implement (source code) a program(name it SumDigits) to sum the total of all digits in an input integer number between 0 and 1000, inclusive. Notice that you need to extract individual digits from the input number using the remainder (modulus) and division mathematical operators. For example, if the input number is 123, the sum of its digits is 6.Document your code and properly label the input prompts and the outputs as shown below.

Sample run 1:

Entered number: 123
Sum of digits: 6

Sample run 2:

Entered number: 588
Sum of digits: 21

Sample run 3:

Entered number: 100
Sum of digits: 1

Program 3: Design (pseudocode) and implement (source code) a program (name it Distance) to compute the distance between 2 points. The program prompts the user to enter 2 points (X1, Y1) and (X2, Y2). The distance between 2 points formula is:

Square_Root [(X2 - X1)^2 + (Y2 - Y1)^2]

Document your code, properly label the input prompts, and organize the outputs as shown in the following sample runs.

Sample run 1:

Entered X1: 1.5
Entered Y1: -3.4
Entered X2: 4
Entered Y2: 5
Distance: 8.764131445842194

Sample run 2:

Entered X1: -5.5
Entered Y1: -8.8
Entered X2: 25
Entered Y2: 4.5
Distance: 33.27371334852784

Sample run 3:

Entered X1: 2
Entered Y1: 2
Entered X2: 10
Entered Y2: 10
Distance: 11.313708498984761

Program 4: Design (pseudocode) and implement (source code)a program (name it DrivingCost) to compute the cost of a road trip. The program prompts the user to enter the distance to be traveled, the car fuel efficiency (mile per gallon), and the fuel cost per gallon. The program computes and displays the trip cost. Document your code and properly label the input prompts and the outputs as shown below.

Sample run 1:

Distance traveled (miles): 100
Miles per gallon (miles): 20
Price per gallon (dollars): 2.0
Trip cost (dollars): 10.00

Sample run 2:

Distance traveled (miles): 500
Miles per gallon (miles): 35
Price per gallon (dollars): 2.50
Trip cost (dollars): 35.71

Sample run 3:

Distance traveled (miles): 78
Miles per gallon (miles): 25
Price per gallon (dollars): 3.0
Trip cost (dollars): 9.36

Format your assignment according to the following formatting requirements:

1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.

2. The response also include a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.

3. Also Include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.

Solution Preview :

Prepared by a verified Expert
Programming Languages: Design and implement a program compute volume of a cylinder
Reference No:- TGS02965451

Now Priced at $40 (50% Discount)

Recommended (99%)

Rated (4.3/5)