a guest Oct 5th, 2010 250 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Lakehead University
  3. Assignment No. 2
  4. Instructor: Dr. Jinan FIAIDHI
  6. 1. Write a program that prompts the user to input an integer between 0 and 35. If the number is less than or equal to 9, the program should output the number; otherwise, it should output A for 10, B for 11, C for 12…, and Z for 35.
  8. 2. In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sides. Write a program that prompts the user to enter the lengths of three sides of a triangle and then outputs a message indicating whether the triangle is a right triangle.
  10. 3. Write a program that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result.(For division, if the denominator is zero, output and appropriate message.) Some sample outputs follow:
  11. 3+4=7
  12. 13*5=65
  14. 4. A bank in your town updates its t customer's accounts at the end of each month. The bank offers two types of accounts: savings and checking. Every customer must maintain a minimum balance. If a customer's balance falls below the minimum balance, there is a service charge of $10.00 for savings accounts and $25.00 for checking accounts. If the balance at the end of the month is at least the minimum balance, the account receives interest as follows:
  16. a) Savings accounts receive 4% interest.
  17. b) Checking accounts with balances up to $5,000 more than the minimum balance receive 3% interest; otherwise, the interest is 5%.
  19. write a program that reads a customer's account number (int type), account type (char; S for savings, C for checking), minimum balance that the account should maintain, and current balance. The program should then output the account number, account type, current balance and appropriate message . Test your program by running five times, using the following data:
  21. 46728 S 1000 2700
  22. 87324 C 1500 7689
  23. 79873 S 1000 800
  24. 89832 C 2000 3000
  25. 98322 C 1000 750.
  26. 5. Write a program that calculates and prints the bill for a cellular telephone company. The 2 types of services: regular and premium. Rates vary based on the type of service and are computed as follows:
  28. Regular service:        $10 plus first 50 minutes are free. Charges for over 50 minutes are $.20 per minute.
  30. Premium service:        $25 plus:
  31.  A. for calls made from 6:00 am to 6:00pm, the first 75 minutes are free; charges over 75 minutes are $.10 per minute.
  32. B. for calls made from 6:00 pm to 6:00 am, the first 100 minutes are free. Charges over 100 minutes are $.05 per minutes.
  34. Your program should prompt the user to enter an account number, a service code (type char), and the number of minutes the service was used. A service code of r or R means regular service; a service code of p or P means premium service. Treat any other character as an error. Program should output the account number, type of service, number of minutes the telephone service was used, and amount due from the user.
  36. For the premium service, the customer may be using the service during the day and the night. Therefore, to calculate the bill, you must ask the user to input the number of minutes the service the service was used during the day and the number of minutes the service was used at night.
  38. Due on October 14
RAW Paste Data