Placeholder

CSIS 209 Programming Assignment 7

$19.00

Description

Based on the program you created for Assignment 5, modify your code to perform the following steps.
In Assignment 5, you created an Account hierarchy with a base class (Account) and two derived classes (SavingsAccount and CheckingAccount). Three of the mutator methods in this assignment validated user input: setBalance, setInterestRate, and setFeeCharged. In all of these methods, you were instructed to set the respective variables equal to zero if the user passed in a negative amount. In this assignment, you will modify your code such that if the user passes in a negative amount, an exception will be thrown that alerts the user that a negative amount has been entered. The program should catch the exception and display the error message to the user. Once an error (negative amount) has occurred, the program should inform the user that negative numbers are not permitted. It should then redisplay the menu. If an exception has not occurred, and a checking or savings object has been successfully created, the program should print the information for that object.
[Hint: You will need to create an exception class – call it NegativeNumberException – that takes a string as an argument to its constructor that represents the error. The string should be “Invalid Entry – Negative numbers are not permitted.”]
Modify your Main() method such that instead of hardcoding the SavingsAccount and CheckingAccount information, you prompt the user to enter the needed information. Generate a menu like the one below and loop until the user enters “Q” to quit the application.
Based on the 18 steps required for Assignment 5, you only need to implement steps 1 and 2 and instantiate their creation based on the user’s menu selections. You may remove steps 3 through 18. This assignment is only intended to demonstrate your ability to handle exceptions.
SCREENSHOTS
SOLUTION
PAYMENT
The solution includes a Visual Studio (c#) project
Attachments [Move over files to preview content of those files]
CSIS209_Programming_Assignment_7.zip (116.02 KB)
CSIS209-Programming-Assignment-7-Screenshot.png
Visual Studio project
CSIS209ProgrammingAssignment7
CSIS209ProgrammingAssignment7
Account.cs
App.config
bin
Debug
CSIS209ProgrammingAssignment7.vshost.exe
CSIS209ProgrammingAssignment7.vshost.exe.config
CSIS209ProgrammingAssignment7.vshost.exe.manifest
CheckingAccount.cs
CSIS209ProgrammingAssignment7.csproj
NegativeNumberException.cs
obj
Debug
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Program.cs
Properties
AssemblyInfo.cs
SavingsAccount.cs
CSIS209ProgrammingAssignment7.sln
CSIS209ProgrammingAssignment7.v12.suo
Preview Account.cs
xxxxxxx xxxxxx xxxxxxxxxxx; // xxxxxxxxxx xxx xxxxxxx xxxxxx’x xxxx xxxx
xxxxxxx xxx xxxxxxxxxxxxx; // xxxxxxxxxx xxx xxxxxxx’x xxxxxx
xxxxxxx xxxxxx xxxxxxx; // xxxxxxxxx xxx xxxxxxx xxxxxxx
public string AccountName { get { return accountName; } set { accountName = value; } }
public int AccountNumber { get { return accountNumber; } set { accountNumber = value; } }
xxxxxx xxxxxx xxxxxxx
{
xxx { xxxxxx xxxxxxx; }
xxx { xxxxxxx = xxxxx; }
}
Preview CheckingAccount.cs
xxxxxxx xxxxxx xxxxxxxxxx;
// xxxxxxx xxxxxxxxx
xxxxxx xxxxxxxxxxxxxxx()
{
}
public CheckingAccount(string accountName, int accountNumber, double initBalance, double feeCharged) : base(accountName, accountNumber, initBalance) { setFeeAmount(feeCharged); }
public void setFeeAmount(double feeCharged) { try
{
xx (xxxxxxxxxx < 0) xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxx("xxxxxxx xxxxx – xxxxxxxx xxxxxxx xxx xxx xxxxxxxxx."); xxxx.xxxxxxxxxx = xxxxxxxxxx; } xxxxx (xxxxxxxxxxxxxxxxxxxxxxx x) Preview NegativeNumberException.cs xxxxx xxxxxx; xxxxx xxxxxx.xxxxxxxxxxx.xxxxxxx; xxxxx xxxxxx.xxxx; xxxxx xxxxxx.xxxx; xxxxx xxxxxx.xxxxxxxxx.xxxxx; namespace CSIS209ProgrammingAssignment7 { class NegativeNumberException : Exception { public NegativeNumberException() { } xxxxxx xxxxxxxxxxxxxxxxxxxxxxx(xxxxxx xxxxxxx) : xxxx(xxxxxxx) { } Preview Program.cs xxxxxx xxxxxx xxxxxx xxxxxxxxxxxxx() { xxxxxxx.xxxxxxxxx("---------------------------- xxxx xxxxxxxxxx -----------------------------"); xxxxxxx.xxxxxxxxx("xxxxxxx xxxxxx"); xxxxxxx.xxxxxxxxx(" x xxxxxxx xxxxxxxx xxxxxxx"); Console.WriteLine(" S tCreate Savings Account"); Console.WriteLine(" Q tQuit the Application"); Console.WriteLine(); bool validate = false; string choice = ""; while (!validate) { try { Console.Write("Enter choice: "); choice = Console.ReadLine().Trim().ToUpper(); if (choice.Equals("C") || choice.Equals("S") || choice.Equals("Q")) { validate = true; } xxxx { xxxxxxx.xxxxxxxxx("xxxxxxx xxxxxx"); xxxxxxx.xxxxxxxxx("xxxxxx xxxxx x xx x xx xx"); } } xxxxx (xxxxxxxxx x) { xxxxxxx.xxxxxxxxx("xxxxxxx xxxxxx"); Preview SavingsAccount.cs xxxxxxx xxxxxx xxxxxxxxxxxx { xxx; xxx; } // xxxxxxx xxxxxxxxx xxxxxx xxxxxxxxxxxxxx() { } public SavingsAccount(string accountName, int accountNumber, double initBalance, double interestRate) : base(accountName, accountNumber, initBalance) { setInterestRate(interestRate); } public void setInterestRate(double interestRate) { try { xx (xxxxxxxxxxxx < 0) xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxx("xxxxxxx xxxxx – xxxxxxxx xxxxxxx xxx xxx xxxxxxxxx."); xxxx.xxxxxxxxxxxx = xxxxxxxxxxxx; } xxxxx (xxxxxxxxxxxxxxxxxxxxxxx x) { Price: $19 Buy Now Checkout Added to cart Buy More Save More Buy at least TWO items & save up to 30% OFF your ENTIRE order! Rack up instant rebates in your shopping cart. Simply add items to your cart, and see the savings add up. Discounts will automatically be applied on eligible orders. CSIS 209 Programming Assignment 7 – $19.00 CSIS 209 Programming Assignment 8 – $25.00 Add to Cart Checkout Added to cart You May Also Like: CSIS 209 Programming Assignment 1 CSIS 209 Programming Assignment 2 CSIS 209 Programming Assignment 3 CSIS 209 Programming Assignment 4 CSIS 209 Programming Assignment 5 CSIS 209 Programming Assignment 6 CSIS 209 Programming Assignment 8

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.