Westonci.ca connects you with experts who provide insightful answers to your questions. Join us today and start learning! Discover precise answers to your questions from a wide range of experts on our user-friendly Q&A platform. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently.

Write a class with methods to help you balance your checking account (an object class-main method is not in this class). The CheckingAccount Class should have at least two instance variables: the balance and the total service charges, along with methods to get and set each instance variable. You may add other variables and methods if you like. The program should read the initial balance for the month, followed by a series of transactions. For each transaction entered, the program should display the transaction data, the current balance for the account, and the total service charges. Service charges are $0.10 for a deposit and $0.15 for a check. If a check forces the balance to drop below $500.00 at any point during the month, a service charge of $5.00 is assessed but only for the first time this happens. Anytime the balance drops below $50.00, the program should print a warning message. If a check results in a negative balance, an additional service charge of $10.00 should be assessed. A transaction takes the form of an int number (the transaction code), followed by a double number (the transaction amount). If the int number is a 1, then the double number is the amount of a check. If the int number is 2, then the double number is the amount of a deposit. The last transaction is 0 with no number to follow it. Use the JOptionPane to produce the dialog. A sample Input/Output dialogue is provided via the Sample Run Link below. Use proper style and indentation, efficient programming techniques and meaningful variable and method names according to Java conventions.Code Template The following code template will help with this assignment:----------------- Main.java ------------------------public class Main { // global variables // define a CheckingAccount object to keep trach of the // account information public static void main (String[] args) { // defines local variables CS 3 – Spring 2017 E. Ambrosio 2 // get initial balance from the user // perform in a loop until the transaction code = 0 // get the transaction code from the user // and process it with appropriate helper method // When loop ends show final balance to user. } public static __________ getTransCode() { } public static _________ getTransAmt() { } public static __________ processCheck(___________) { } public static __________ processDeposit(___________) { } } --------------------CheckingAccount.java ------------------------- public class CheckingAccount { private double balance; private double totalServiceCharge; public CheckingAccount(double initialBalance) { balance = ______________________; totalServiceCharge = ______________; } public ____________ getBalance() { return _______________; } CS 3 – Spring 2017 E. Ambrosio 3 public void setBalance(double transAmt, int tCode) { if(tCode == 1) balance = ___________________; else //if(tCode == 2) balance = ______________________; } public ____________ getServiceCharge() { return totalServiceCharge; } public void setServiceCharge(double currentServiceCharge) { totalServiceCharge = ___________________________; } }

Sagot :

Using JAVA knowledge to write code about creating a bank account and using the data to make a transition.

Writing the code in JAVA, we have:

CheckingAccount.java

package bankAccount;

public class Transaction {

int transNumber;

int transId;

double transAmt;

public Transaction(int transNumber, int id, double amount) {

this.transNumber = transNumber;

this.transId = id;

this.transAmt = amount;

}

public int getTransNumber() {

return transNumber;

}

public void setTransNumber(int transNumber) {

this.transNumber = transNumber;

}

public int getTransId() {

return transId;

}

public void setTransId(int transId) {

this.transId = transId;

}

public double getTransAmt() {

return transAmt;

}

public void setTransAmt(double transAmt) {

this.transAmt = transAmt;

}

public String toString() {

return "Transaction Number: " + transNumber + ", Transaction ID: " + transId + " Transaction Amount: " + transAmt;

}

}

See more about JAVA at brainly.com/question/12975450

#SPJ1

View image lhmarianateixeira
View image lhmarianateixeira
View image lhmarianateixeira
View image lhmarianateixeira