Lab 2 Programming with C

Skill set for this LAB:

Problem 1
Write a program that reads the number of days the person stays in the hotel, the price of the hotel per day, and the tax (integer). The program finds and prints the total price of the hotel stay.

Problem 2 : Write a program that finds total cost of shopping cart and average price per item. You buy the following items: milk, bread, and prepared chicken.
Input: number of milk bottles, price per bottle, number of bread loafs, price per loaf, number of prepared chickens, price of prepared chicken, and the tax. ONLY PREPARED FOOD is taxable

Problem 3: :
The final grade in our course is calculated according to the following rule:

Final Grade

Laboratory Sessions 45%
Exams 35%
Mini-Quizzes 15%
Homework and Attendance 5%
Write a program that asks user to enter the average grade for all quizzes, average grade for all exams, average grade for all homeworks, and the lab grade. The program calculates the final grade in the course.

Problem 4
Write a program that reads total amount of the loan taken in the bank, the down payment, and the loan tearm (the number of YEARS the loan is taken for). The program calculates and displays the monthly payment - the amount user would need to pay every month to return the loan. Make your program to round result to two decimal places.

Examples - use these examples to TEST your program Input: loan: $1200, down payment: $200, term: 1 year (pay attention it is 12 month!)
Output: the monthly payment is $83.33

  • Input: loan: $1200, down payment: $200, term: 2 year (pay attention it is 24 month!)
    Output: the monthly payment is $41.67

  • Input: loan: $2000, down payment: $600, term: 3 year (pay attention it is 36 month!)
    Output: the monthly payment is $38.89

    Problem 5 :
    A treasure box has a 4-digit combination lock. The box opens when you enter the following value: (sum of middle digits)*(average of first and last digit). Write a program that reads one 4-digit number, combination lock, and finds the number that opens the box.

    Problem 6 :
    Most savings accounts offer interest to keep your money growing. Write a program that reads initial deposit into saving account and interest rate per year (as integer). The program finds and prints the amount you will have in the saving account after one year.

    IF ELSE STATEMENT Practice

    Problem 7 :
    Write a program that prompts the user to enter one positive 4 digits integer. The program will do the following: if the input number is even, the program will print the digits of the number in the reverse order, and if the input number is odd, the program will calculate the sum and the product of the digits and prints the result with the appropriate message. Hint: An even number is an integer that is "evenly divisible" by 2, i.e., divisible by 2 without remainder i.e., remainder = 0

    Problem 8 :
    Most online shopping websites offer free shipping if you spend certain amount of money. Write a program that reads the following information: the purchase amount before tax, free shipping rule (the smallest amount of dollars consumer must spend to receive a free shipping), the tax percent(integer), and flat shipping charges. We will assume that the shipping charges are always the same and shipping charges ARE TAXABLE. The program will calculate and prints the total price of your purchase. For example: macys.com offers free shipping if you spend 99 dollars and more, so if you will spend 50 dollars, and the shipping charges are 3.99, and your state tax is 7%, the total price will be: $57.77 For example: target.com offers free shipping if you spend 50 dollars or more, so if you will spend $99.99, and the shipping charges are 5.99, and your state tax is 6%, the total will be $105.99