The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 5 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Select all the claims that are true about the exerciseTransactions method of Listing 2, line 45? (Check all that apply.)
A. It is being called from line 31 of Listing 2.
B. The size of the values it uses for credits and debits is controlled by the limit parameter.
C. It will call the credit method twice as often as it calls the debit method.
D.It will make multiple calls to Account class methods based on the value of testCount
CSC-240 Java Programming A????1 Exam One Listings
Page 3 of 6
Listing 2
1 package edu.frontrange.csc240.exam1;
2
3 import java.util.Scanner;
4 import java.util.Random;
5
6 public class AccountTester
7 {
8 Random randomNumbers = new Random();
9 Scanner userInput = new Scanner(System.in);
10
11 public void testAccountClass()
12 {
13 System.out.println("\n\n*** Testing the Account Class ***");
14
15 System.out.printf("\nCurrent Interest Rate: %.2f%%", Account.CURRENT_RATE *
16 100.0);
17
18 System.out.println("\n\nCreating Account Objects");
19 Account accountOne = new Account(5000.0);
20 Account accountTwo = new Account(accountOne);
21 accountOne.displayValues("\nInitial Values for Account One:");
22 accountTwo.displayValues("\nInitial Values for Account Two:");
23
24 System.out.println("\n\nExercising Account Transactions");
25 accountOne.credit(0.0);
26 accountOne.debit(-6);
27 accountTwo.credit(-1.50);
28 accountTwo.debit(100.0);
29 accountTwo.debit(5000);
30 exerciseTransactions(accountOne, 100, 500.0);
31 exerciseTransactions(accountTwo, 250.0);
32 accountOne.displayValues("\n\nUpdated Values for Account One:");
33 accountTwo.displayValues("\nUpdated Values for Account Two:");
34
35 System.out.println("\n\nExercising Future Value Calculators");
36 System.out.printf(" Calculation 1: $%.2f\n", accountOne.futureValue(6.5,
37 0.05));
38 System.out.printf(" Calculation 2: $%.2f\n", accountOne.futureValue(15,
39 0.05));
40 System.out.printf(" Calculation 3: $%.2f\n", accountTwo.futureValue(6.5));
41 System.out.printf(" Calculation 4: $%.2f\n", accountTwo.futureValue(15));
42 System.out.println("\n\n*** Testing Complete ***\n");
43 }
44
45 private void exerciseTransactions(Account thisAccount, int testCount,
46 double limit)
47 {
48 int count = 0;
49 while( count < testCount )
50 {
51 if( (count % 3) != 0 )
52 thisAccount.credit(getDataValue(limit));
53 else
54 thisAccount.debit(getDataValue(limit));
55 count++;
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll