Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// This class will be tested public class MathMachine { // One variable as operands for the math operations // values assigned in main by

image text in transcribed

// This class will be tested public class MathMachine { // One variable as operands for the math operations // values assigned in main by VPL testing system. private int cardBalance; // Bring in the variable values from outside MathMachine to be used // inside MathMachine. VPL's JUnit will do this. No changes here. public MathMachine (int userInputOne) { this.cardBalance = userInputOne; } // Dear student: make changes below here. // -------------------------------------------------- // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv // Operation: Transaction Request // This is used to check whether the transaction can be made // Compare the charge value against the card balance and accept or decline // Modify between { and }. If valid (accepted), return true. If not valid // (declined) return false. Print information to inform the user. public boolean transactionRequest(int chargeValue) { if () // Dear student: Modify this line { System.out.println("The requested amount exceeds the amount in the account"); return false; } else { System.out.println("The requested amount is okay."); return true; } } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // --------------------------------------------------- // Dear student: make changes above here. }

Requested files MathMachine.java 1 // This class will be tested 2. public class MathMachine { 3 4. // One variable as operands for the math operations 5 // values assigned in main by VPL testing system. 6 private int cardBalance; 7 8 // Bring in the variable values from outside MathMachine to be used 9 // inside MathMachine. VPL's JUnit will do this. No changes here. 10 public MathMachine (int user Inputone) 11 {l 12 this.cardBalance = userInputne; 13 } 14 15 // Dear student: make changes below here. 16 17 // 18 19 // Operation: Transaction Request 20 // This is used to check whether the transaction can be made 21 // Compare the charge value against the card balance and accept or decline 22 // Modify between { and }. If valid (accepted), return true. If not valid 23 // (declined) return false. Print information to inform the user. 24 public boolean transactionRequest(int chargeValue) 25 { 26 if () // Dear student: Modify this line 27- { 28 System.out.println("The requested amount exceeds the amount in the account"); 29 return false; 30 } 31 else 32 { 33 System.out.println("The requested amount is okay."); 34 return true; 35 } 36 } 37 38 // 39 40 // Dear student: make changes above here. 41 }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions