0

This program asks the user to enter pricer for items. The user enters a price of 0 to stop. The program then prints a reciept including a list of items bought arranged from least to most expensive, and a total that includes 5% sales tax.

I am lost can anyone help?

3
Contributors
3
Replies
5
Views
4 Years
Discussion Span
Last Post by zeroliken
0
import java.util.Scanner;

public class GuessANumber
{
    public static void main (String[] args)
    {
        Scanner keyboard = new Scanner(System.in);
        int count = 1;
        long number = (Math.round(Math.random() * 100));
        int guess;
            while (count== 1)
        {

            System.out.println("Guess a number between 1 and 100");
            guess = keyboard.nextInt ();

            if (number > guess)
            {
                System.out.println("Nope, too low.");
            }
            if (number < guess)
            {
                System.out.println("Nope, too high.");
            }
            if (number == guess)
            {
                System.out.println("Congrats, You got it!");
                count = 0;
            }
        }
    }
}
0

The code you posted is different than the program details from your first post, care to explain?

Edited by zeroliken

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.