Using Java to create a calculator that calculates total weight and price of rice
Go to solution
Solved by guitargirl15,
1. You don't need the if(x==0) check, because if x==0 it will go to the top of the while loop, see that x != 0 is not true, and stop.
2. Make the Scanner object before displaying any text
3. Before asking for the weight of rice per bag, ask for the price per kilogram. Store the result in a variable (double price = keyboard.nextDouble())
4. Use `price` to calculate your final price at the end
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now