Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ex: If the input is: 100 200 50 n the output is: Enter a starting balance Enter credits Enter debits Your new balance is: 250.00

Ex: If the input is:

100 200 50 n 

the output is:

Enter a starting balance Enter credits Enter debits Your new balance is: 250.00 Continue?: y / n 

REQUIREMENTS

  1. Prompt user for an opening balance, credits, and debits.
  2. Output the new balance
  3. The user should be prompted to enter new credits and debits until they indicate the are ready to exit the program

Note:

Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue);

Hints:

You have to store dollars and cents, so think about what variable types you'll be using for beginning balance, debits and credits A while loop will prompt the user to enter debits and credits until the user enters a "n". You'll need to prompt the user for a single character (y or n). This is how you do it: userChar = scnr.next().charAt(0);

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

/* Type your code here. */

}

}

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_2

Step: 3

blur-text-image_3

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

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

=+d) Are time and day of the week independent events?

Answered: 1 week ago

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago

Question

Was there an effort to involve the appropriate people?

Answered: 1 week ago