Blog

Program both problems in one main method. Use at least one switch code. Test your program with data that tests all branches of your decision statements. Store constant values in final variables. statement in your 1. An Internet provider has three different subscriptions packages for its customers: Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour. For $13.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour. Package B: Package C: For $19.95 per month unlimited access is provided. Write a program that calculates a customer’s monthly bill. It should ask the user to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours that were used. It should then display the total charges. 2. Modify the program you wrote for problem #1 so it also calculates and displays the amount of money Package A customers would save if they purchased Package B or C, and the amount of money Package B customers would save if they purchased Package C. If there would be no savings, no message should be printed. Show transcribed image text

Questions viewed by other students

12.6 Create a web page in which the user is allowed to selectthe page’s background color and whether the page uses serif or sansserif fonts. Then change the body element’s style attributeaccordingly.

Gray background

White background

Sans-serif text

Serif text

If the user onclicks any of the options, the webpage will turninto that format. For example, if the user clicks “Gray backgound”,the background color of the webpage will be Gray. If the userclicks Serif-text, the text in the web page will be in Seriftext.

That’s it! You do not have to consider the user to really editthe webpage. Please see the attached webpage image.

Read in a file of complex numbers (sample is attached 126import.txt) and store them in an array of complex objects. (Would you be able to do either static or dynamic array?) You can a so do oad unctions o make more complete The is and save unct or needs o o to the num bers n ascending on era :on s reate a menu o a low console add delete / st and save unctions. value. The value of a complex number a+bi is sqrt(a a*b*b). Save function stores the results to file 126complex.txt. Note If you can not handle a few corner cases, e.g. the last 3 complex number, remove them and focus on the main part. You will not get the full grade, but at least you need to get some code working You need to implement operator overloading to compare complex numbers as well as stream insertion/ extraction operators It is highly recommended that you implement TWO classes (complex and complexDB) for this lab. It will be a good foundation for future data structure practices Show transcribed image text

Expert Answer

12.25 (New Account class) An Account class was specified in Programming Exercise 9.3. Modify the Account class as follows: Assume that the interest rate is same for all accounts. So, the annualInterestRate property should be static. ■ Add a new data field name of the string type to store the name of the customer. Add a new constructor that constructs an account with the specified name, id, and balance Add a new data field named transactions whose type is vector-Transaction- that stores the transaction for the accounts. Each transaction is an instance of the Transaction class. The Transaction class is defined as shown in Figure 12.4 ■ Modify the withdraw and deposit functions to add a transaction to the transactions vector ■ All other properties and functions are same as in Programming Exercise 9.3 The get and set functions for these data fields are provided in the class, but omitted in the UML diagram for brevity Transaction -date: Date -type: char -amount: double The date of this transaction. Date is defined in Exercise 9.8. The type of the transaction. such as ‘W for withdrawal, D for deposit. ete. The amount of the transaction. balance: double description: string +Transaction(type: char, I he new balance after this transaction I he description of this transaction Construct a Transaction with the specified Jate, type, balance and description. amount: double, balance: double, description: string) FIGURE 12.4 The Transaction class describes a transaction for a bank account Write a test program that creates an Acc ount with annual interest rate 1.5 ance 1000, id 1122, and name George. Deposit $30. $40. $50 to the account and withdraw $5. S4. $2 from the account. Print account summary that shows account holder name, interest rate. balance, and all uransaction Show transcribed image text 12.25 (New Account class) An Account class was specified in Programming Exercise 9.3. Modify the Account class as follows: Assume that the interest rate is same for all accounts. So, the annualInterestRate property should be static. ■ Add a new data field name of the string type to store the name of the customer. Add a new constructor that constructs an account with the specified name, id, and balance Add a new data field named transactions whose type is vector-Transaction- that stores the transaction for the accounts. Each transaction is an instance of the Transaction class. The Transaction class is defined as shown in Figure 12.4 ■ Modify the withdraw and deposit functions to add a transaction to the transactions vector ■ All other properties and functions are same as in Programming Exercise 9.3 The get and set functions for these data fields are provided in the class, but omitted in the UML diagram for brevity Transaction -date: Date -type: char -amount: double The date of this transaction. Date is defined in Exercise 9.8. The type of the transaction. such as ‘W for withdrawal, D for deposit. ete. The amount of the transaction. balance: double description: string +Transaction(type: char, I he new balance after this transaction I he description of this transaction Construct a Transaction with the specified Jate, type, balance and description. amount: double, balance: double, description: string) FIGURE 12.4 The Transaction class describes a transaction for a bank account Write a test program that creates an Acc ount with annual interest rate 1.5 ance 1000, id 1122, and name George. Deposit $30. $40. $50 to the account and withdraw $5. S4. $2 from the account. Print account summary that shows account holder name, interest rate. balance, and all uransaction