Sei sulla pagina 1di 3

CS171 Introduction to Programming Using VB 2008 Spring 2011 Assignment#3 Due date: Thursday, Mar.

17, 2011 by 3:00pm


Note: You are encouraged to discuss homework problems with other students (and with the instructor), but you must write your final answer by yourself. Solutions prepared in committee or by copying someone elses work are not acceptable.

1. Validating Triangles The Triangle Inequality theorem states that the sum of the lengths of any two sides of a triangle is greater than the length of the third side. Write a program that reads three edges for a triangle and determines whether the input is valid. The input is valid if the sum of any two edges is greater than the third edge. For example, if your input for three edges is 1, 2, 1, the output should be: Can edges 1, 2, and 1 form a triangle? No. A possible layout and sample output are shown below.

2. Bank Accounts A bank in your town updates its customers accounts at the end of each month. The bank offers two types of accounts: savings and checking. Every customer must maintain a minimum balance for checking is $100, and for savings is $50. If a customers balance falls below the minimum, 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 following: Savings accounts receive 4% interest. Checking accounts with balances up to $5000 receive 3% interest; otherwise, the interest is 5%. Write a program that reads a customers account number which is an 8-digit number (use maskedTextbox for this input). An account type is either Savings or Checking, and current balance. The program should then output the account number, account type, minimum balance for the account, updated balance, and appropriate information which tell the user about the updated information.

1/3

Notes and Restriction: If the account number, current balance, or account type is left blank, a message box should be displayed on the screen and asks for a valid entry respectively. A possible layout and sample output

3. Internet Service Provider An Internet service provider offers three subscription packages to its customers, plus a discount for nonprofit organizations: a. Package A: 200 hours of access for $9.95 per month. Additional hours are $2.00 per hours. b. Package B: 400 hours of access for $14.95 per month. Additional hours are $1.00 per hour. c. Package C: Unlimited access for $19.95 per month. d. Nonprofit Organizations: the service provider gives all nonprofit organizations a 20% discount on all packages. The user should select the package the customer has purchased (from a set of option buttons) and enter the number of hours used. A check box captioned Nonprofit Organization should also appear on the form. The application should calculate and display the total amount due. If the user selects the Nonprofit Organization check box, a 20% discount should be deducted. Notes and Restriction: An error message should be displayed if the user enters a number less than 1 or greater than 744. For the Calculate button, first confirm the entered data with the user. If all the data entered is correct, then display the total charge. Otherwise, the application should allow the user make some changes. A possible layout and sample output

2/3

Submission requirements: 1. Submit the hard copies of the code, along with your name, course number, and section number printed on the General Declaration section of the code editor. 2. Compress each program file into a .zip file; then upload the compressed file (the .zip file) to the Assignment3 folder in the Drop box on D2L. Note: Here is the link to make a .zip file: http://condor.depaul.edu/~slytinen/instructions/zip.html

3/3

Potrebbero piacerti anche