Make up Assignment/Test/Mini Quizzes Questions

  • Problem 1:

    The date June 10, 1960, is called a "special date" because when it is written in the following format:6/10/60 the month (= 6) times the day (= 10) equals the year (= 60).

    Write a program which asks the user to enter a month, a day, and a 2-digit year - all in numeric form. The program will then determine whether the date is a "special date" or not.

  • Problem 2:

    Write a function salary that has one parameter - number of employees in the company. The function reads the annual salary company pays to each employee. Assume that the Federal Tax withdrawal is 27% and State Tax is 12%. Function finds and returns total amount paid to all employees for one year, total amount of Federal Tax paid by all employees and total amount of State Tax paid by all employees.

    Write main to test your function.

  • Problem 3:

    Write a function is_dollar that has 4 parameters: number of pennies, nickels, dimes and quarters. If the total value of the coins is equal to 1 dollar, the function returns 0, if less then 1 dollar the function returns -1, and if larger then 1 dollar the function returns 1.

    Write a program reads number of users first, then for each user program reads the number of pennies, nickels, dimes and quarters. The program finds the number of users who entered exactly 1 dollar, the number of users who entered less than 1 dollar, and the number of users who entered more than 1 dollar.

  • Problem 4:

    Bed bath and beyond offers the following coupons: 10 off of 30 dollars or more and 20% of entire purchase

    Write a function final_price that has one parameter - price of the purchase, the function checks which offer is eligible and which one is a better option for the customer and returns 1 if 10 off was applied and 2 if 20% off was applied. In addition, function returns final price of the purchase. In case and both coupons give the same discount assume customer got 10 off discount (function returns 1)

    write function process that has one parameter - number of customers visited BBB on Black Friday. For each customer function reads price of the purchase. Then the function prints final price using function final_price and returns the number of customers who got 10 off discount and number of customers who got 20% off discount

    Write main to test your function process.