Starting from:

$30

CSE1242-Homework 1 Solved

Write a program that prompts the user to enter the distance to drive, the fuel efficiency of the car in miles per gallon, and the price per gallon, and displays the cost of the trip.
 

 

Sample Run:

Enter the driving distance: 900.5

Enter miles per gallon: 25.5

Enter price per gallon: 3.55

The cost of driving is $125.36

 

Write a program that converts a date that is given in days to “Year: <years>, Month: <months>, Day: <days>” format.1 year consists of 365 days, 12 months.
1 month consists of 31 days.
Be sure your program works correctly. Test your program on several different values.
 

 

Sample Run 1:

Number of days: 100

Year: 0, Month: 3, Day: 7.

 

 

Sample Run 2:

Number of days: 366

Year: 1, Month: 0, Day: 1.

 

 

Sample Run 3:

Number of days: 397

Year: 1, Month: 1, Day: 1.

 

 

Write a program that will calculate the compound monthly interest. The program asks user to enter the values forinitial principal in TL/USD, etc. (p),
annual interest rate percentage (r),
number of time periods in months (t), and calculates the corresponding
monthly interest rate percentage (r/12),
total compound interest amount in TL/USD, etc. (i),
final balance amount in TL/USD, etc. (f) using the following formulae.
𝑟       𝑡

𝑖 = 𝑓 −𝑝                                                        𝑓

Be sure your program works correctly. Test your program on several different values.
Print output values using at most 2 digits after the decimal point.
 

 

Sample Run 1:

Enter initial principal amount: 10000

Enter annual interest rate (e.g. 9.45): 10

Enter number of time periods in months: 12

 

Initial principal amount: 10000.0

Monthly interest rate: 0.83

Total compound interest amount: 1047.13

Final balance amount: 11047.13

 

 

Sample Run 2:

Enter initial principal amount: 5000

Enter annual interest rate (e.g. 9.45): 12

Enter number of time periods in months: 2

 

Initial principal amount: 5000.0

Monthly interest rate: 1.0

Total compound interest amount: 100.5

Final balance amount: 5100.5

 

 

Sample Run 3:

Enter initial principal amount: 7000

Enter annual interest rate (e.g. 9.45): 8.25

Enter number of time periods in months: 18

 

Initial principal amount: 7000.0

Monthly interest rate: 0.68

Total compound interest amount: 918.77

Final balance amount: 7918.77

 

More products