Starting from:
$30

$24

Homework 1 grade_need.c & loan_cost.c SOlution

Files to submit: grade_need.c




Time it took Matthew to complete: 5 minutes




All programs must compile without warnings when using the -Wall and -Werror options



Submit only the files requested



Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc



Your program must match the output exactly to receive credit.



Make sure that all prompts and output match mine exactly.



Easiest way to do this is to copy and paste them



All input will be valid unless stated otherwise



The examples provided in the prompts do not represent all possible input you can receive.



All inputs in the examples in the prompt are underlined



You don't have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program



If you have questions please post them on Piazza






As an instructor I am frequently asked at the end of the quarter what is the minimum grade I need to get on my final to get an X in the class. So in order to help me answer this question a little early you are going to write a program that calculates just that.




Your program should ask for the following input in this order

The letter grade you want to get in the class
What percent you need to get in the class to get that grade (a value from 0 – 100)
What percent you currently have in the class (a value from 0 – 100)
The weight of the final (a value from 0 – 100)



Your program should then output the minimum grade you need to get on the final to achieve the desired score.




Examples

Enter the grade you want in the class: B
Enter the percent in the class you need in the class to get that grade: 80

Enter your current percent in the class: 75

Enter the weight of the final: 20

You need to get at least 100.00% on the final to get a B in the class.

Enter the grade you want in the class: A
Enter the percent in the class you need in the class to get that grade: 90

Enter your current percent in the class: 83

Enter the weight of the final: 30

You need to get at least 106.33% on the final to get a A in the class.

Enter the grade you want in the class: B
Enter the percent in the class you need in the class to get that grade: 85

Enter your current percent in the class: 72

Enter the weight of the final: 50

You need to get at least 98.00% on the final to get a B in the class.










Files to submit: loan_cost.c




Time it took Matthew to complete: 5 minutes




All programs must compile without warnings when using the -Wall and -Werror options



Submit only the files requested



Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc



Your program must match the output exactly to receive credit.



Make sure that all prompts and output match mine exactly.



Easiest way to do this is to copy and paste them



All input will be valid unless stated otherwise



The examples provided in the prompts do not represent all possible input you can receive.



All inputs in the examples in the prompt are underlined



You don't have to make anything underlined it is just there to help you differentiate between what you are supposed to print and what is being given to your program



If you have questions please post them on Piazza






For this problem you will be calculating the monthly payment on a loan as well as the cost of borrowing the loan. The payment amount of a loan is calculated as




payment=
iP
1−(1+i)−n
where

P = principal (amount you borrowed)

i = interest rate

n = total number of payments




Your program should ask the user for the following information in this oreder

The amount they are borrowing
The annual interest rate
1. We will assume that interest is going to compounded monthly for this problem (the norm)




so the actual interest rate to use in the formula will be
1
of the annual interest rate
12
3. The number of payments to be made




Your program should report the monthly payment amount as well as the cost of the loan (total paid on the loan minus the principal).







Additional notes.

You will need to use the pow function to calculate the cost of the payment so don't forget to include math.h and to compile with -lm
Examples

Please enter the amount of money you borrowed: $1000
Please enter the annual interest rate: .05

Please enter the number of payments to be made: 12

A loan of $1000.00 with an annual interest of 0.05 payed off over 12 months will have monthly payments of $85.61.

In total you will pay $1027.29, making the cost of your loan $27.29.




Please enter the amount of money you borrowed: $60000
Please enter the annual interest rate: .07

Please enter the number of payments to be made: 120

A loan of $60000.00 with an annual interest of 0.07 payed off over 120 months will have monthly payments of $696.65.

In total you will pay $83598.11, making the cost of your loan $23598.11.

More products