Concept explainers
- 1. Read the problem statement.
- 2. Formulate the
algorithm using pseudocode and top-down, stepwise refinement. - 3. Write a Java
program . - 4. Test, debug and execute the Java program.
- 5. Process three complete sets of data.
(Credit Limit Calculator) Develop a Java application that determines whether any of several department-store customers has exceeded the credit limit on a charge account. For each customer, the following facts are available:
- 1. account number
- 2. balance at the beginning of the month
- 3. total of all items charged by the customer this month
- 4. total of all credits applied to the customer’s account this month
- 5. allowed credit limit.
The program should input all these facts as integers, calculate the new balance (= beginning balance + charges – credits), display the new balance and determine whether the new balance exceeds the customer’s credit limit. For those customers whose credit limit is exceeded, the program should display the message "Credit limit exceeded".
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Java How to Program, Early Objects (11th Global Edition)
Additional Engineering Textbook Solutions
Database Concepts (8th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Concepts Of Programming Languages
Starting Out with C++: Early Objects
Problem Solving with C++ (10th Edition)
- (Thermodynamics) a. Design, write, compile, and run a program that determines the work,W, performed by a piston engine providing a force of 1000 N over a distance of 15 centimeters. The following formula is used to determine the work performed: W=Fd F is the force provided by the piston in Newtons. d is the distance the piston moves in meters. b. Manually check the values computed by your program. After verifying that your program is working correctly, modify it to determine the work performed by six pistons, each providing a force of 1500 N over a distance of 20 centimeters.arrow_forwardJAVA based program need helparrow_forwardJava program: Please help me with this, I want the code without the if statement, and the variables names should be a,b,x,y thank you so mucharrow_forward
- hope you get it fast for mearrow_forwardAnswer to each question should be a executable java code, tested and run You implement each question in a separate .java file.arrow_forwardHelp needed ASAP! Language: JAVA Fill in your code for the following program that takes two words as input from the keyboard, representing a user ID and a password, then the program does the following: If the user ID and the password match “admin” and “open”, respectively, then output “Welcome”. If the user ID matches “admin” and the password does not match “open”, output “Wrong password”. If the password matches “open” and the user ID does not match “admin”, output “Wrong user ID”. Otherwise, output “Sorry, wrong ID and password”. import java.util.Scanner; public class Login{ public static void main(String[] args){ Scanner scan = ____ Scanner(________);//instantiate a Scanner object String userID = scan._________; // read the user ID String password = scan.__________; // read the password if(________________________________) { System.out.println("Welcome"); } else if(___________________________) { System.out.println("Wrong password"); } else…arrow_forward
- CODE IN C# NOT JAVA (reject if you can't do C# please): Write an application that runs 1,000,000 games of craps and answers the following questions (explain each step): How many games are won on the first roll, second roll, …, twentieth roll and after the twentieth roll? How many games are lost on the first roll, second roll, …, twentieth roll and after the twentieth roll? What are the chances of winning at craps? [Note: You should discover that craps is one of the fairest casino games. What do you suppose this means?] What is the average length of a game of craps?arrow_forwardneed help in java. (1) Prompt the user for a string that contains two strings separated by a comma. (1 pt) Examples of strings that can be accepted: Jill, Allen Jill , Allen Jill,Allen Ex: Enter input string: Jill, Allen (2) Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered. Note: If the input contains a comma, then assume that the input also contains two strings. (2 pts)Ex: Enter input string: Jill Allen Error: No comma in string. Enter input string: Jill, Allen (3) Extract the two words from the input string and remove any spaces. Store the strings in two separate variables and output the strings. (2 pts)Ex: Enter input string: Jill, Allen First word: Jill Second word: Allen provided code: import java.util.Scanner; public class ParseStrings { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); /* Type your code here. */ }} (4) Using a loop, extend the program to handle…arrow_forward2. CommodityCode.java (Use switch) A certain store has the following scheme: Commodity Code: commodities are discounted by 15% commodities are taxed by 12% commodities are charged as priced B Create a java program that reads a commodity code, quantity of the commodities bought and the unit price. The program should output the amount to be paid by the customer. Depicted below are sample outputs when the program is executed (the items in red bold characters are inputted by the user, while the items in blue bold characters are calculated and outputted by the program): Enter commodity code: A Enter quantity of commodity: 2 Enter unit price: 53.25 Amount to be paid is P90.53 Enter commodity code: E Invalid Code Enter commodity code: B Enter quantity of commodity: 2 Enter unit price: 53.25 Amount to be paid is P119.28 Enter commodity code: A Enter quantity of commodity: 2 Enter unit price: 53.25 Amount to be paid is P106.50arrow_forward
- Language: JAVAarrow_forwardQ1: Can you read this question carefully rebug and type the answers Debug Problem 1: As an intern for The Weather Channel, you have been instructed to debug a java program that converts Celsius to Fahrenheit. If the formula runs correctly, then 12 degrees in Celsius should give 54 degrees in Fahrenheit . Here is the formula given and it might not be correctly stated in terms of () needed and the order of operations. Google a reputable site if needed.: °F = °C x 9/5 + 32 Remember that there may be more than one problem to fix. It could be that variables have an incorrect data type. It could be that the formula is not coded correctly. Also, some import statements could be missing. Copy and paste the code below in JGrasp and debug the code. Here is the code to debug: // Convert Celsius to Fahrenheit class CelsiusToFahr { public static void main (String args[]) { Scanner keyboard = new Scanner(System.in); int celsius = 0; int fahr = 0; System.out.println("Input the degrees in…arrow_forwardCorrect and detailed answer please. Thank you!arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr