[Solved] SOLVED:Program 2: GringottsAccount

$25

File Name: SOLVED:Program_2:_GringottsAccount.zip
File Size: 320.28 KB

SKU: [Solved] SOLVED:Program 2: GringottsAccount Category: Tag:
5/5 - (1 vote)

PurposeA common task is to write software that integrates with previously written code. In this assignment, you are given a Driver program and must add a GringottsAccount class to make the Driver program work. This assignment will also help you gain experience with mathematical equations.Getting StartedCreate a BlueJ project named Program2.Add a class named Driver and then copy this code into it.Create a class named GringottsAccount. You will need to develop this class from scratch such that it integrates properly with the Driver class.GringottsAccount MethodsThe constructor method header should be public GringottsAccount(String inOwner, int inGalleons, int inSickles, int inKnuts). You may assume that an account will not be initialized with more than one million (1000000) Galleons, one million Sickles and one million Knuts.The reader method public int getGalleons() should return the number of Galleons in the account.The reader method public int getSickles() should return the number of Sickles in the account.The reader method public int getKnuts() should return the number of Knuts in the account.The reader method public String getOwner() should return the name of the owner of the account.The method public void convertToGalleons should convert the money in the account to the maximum number of Galleons. As a reminder, there are 17 Sickles in a Galleon and 29 Knuts in a Sickle.The method public void convertToSickles() should convert the money in the account to the maximum number of Sickles.The method public void convertToKnuts() should convert the money in the account to the maximum number of Knuts.Sample OutputWhen the above program is run after you have supplied the missing GringottsAccount, this output should be produced for Ron Weasley. The first chunk of information shows the original account information. The second chunk shows what Rons account looks like after it is converted to the maximum number of Galleons. The third chunk shows what Rons account looks like after it is converted to the maximum number of Knuts. The fourth chunk shows what Rons account looks like after it is converted to the maximum number of Sickles.Grading 100 points10 points the GringottsAccount instance variables galleons, sickles and knuts are all of type int. The GringottsAccount instance variable owner is of type String.10 points the GringottsAccount constructor is correct.5 points the reader methods getOwner, getGalleons, getSickles and getKnuts are correct20 points the method convertToGalleons is correct (5 points will be lost for each failed test case)20 points the method convertToSickles is correct (5 points will be lost for each failed test case)15 points the method convertToKnuts is correct (5 points will be lost for each failed test case)10 points the GringottsAccount class is commented appropriately10 points Good programming and object-oriented programming principles are used throughout the GringottsAccount class

Reviews

There are no reviews yet.

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

Shopping Cart
[Solved] SOLVED:Program 2: GringottsAccount
$25