CS480 Assignment 2

Assignment Question 1:

Use a one-dimensional array to solve the following problem: A company pays its salespeople on a commission basis. The salespeople receive $200 per week, plus 9% of their gross sales for that week. For example, a salesperson who grosses $5,000 in sales in a week receives $200 plus 9% of $5,000, a total of $650. Write an app (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assuming that each salesperson’s salary is truncated to an integer amount): $200–299, $300–399, $400–499, $500–599, $600–699, $700–799, $800–899, $900–999 and over $999.

Write an application that prompts the user to enter the sales for each employee, then it calculates the salesperson’s salary. The process repeats until the user finishes entering all employees' information. When the user is done entering this information, it displays how many of the salespeople earned salaries in each of the above ranges.

Assignment Question 2:

Standard telephone keypads contain the digits zero through nine. The numbers two through nine each have three letters associated with them. Many people find it difficult to memorize phone numbers, so they use the correspondence between digits and letters to develop seven-letter words that correspond to their phone numbers. For example, a person whose telephone number is 686-2377 might use the correspondence indicated in Fig. 7.29 to develop the seven-letter word “NUMBERS.” Every seven-letter word corresponds to exactly one seven-digit telephone number. A restaurant wishing to increase its takeout business could surely do so with the number 825-3688 (that is, “TAKEOUT”).

Digit

Letters

A B C

D E F

G H I

J K L

M N O

P R S

T U V

W X Y

Every seven-letter phone number corresponds to many different seven-letter combinations. Unfortunately, most of these represent unrecognizable juxtapositions of letters. It’s possible, however, that the owner of a barbershop would be pleased to know that the shop’s telephone number, 424-7288, corresponds to “HAIRCUT.” A veterinarian with the phone number 738-2273 would be pleased to know that the number corresponds to the letters “PETCARE.” An automotive dealership would be pleased to know that the dealership number, 639-2277, corresponds to “NEW-CARS.”

Write an app that allows the user to enter a seven-digit number, and displays every possible seven-letter word combination corresponding to that number. Avoid phone numbers with the digits 0 and 1.

Assignment Question 3:

A bank wants you to create a GUI app that will allow bank employees to view the clients’ information. The app should prompt the user to enter first name, last name, account number and account balance. It should provide options to allow the bank manager to search through each client’s information backward and forward. Create a Customer class to represent the client with first name, last name, account number and account balance. The application should use an array of Customer objects to store customer information. DO NOT use any collection classes such as ArrayList, LinkedList, HashSet etc. You can only use the following statement that assumes the maximum number of customers is 100

Customer [] customerList = new Customer [100];