package Assignments1;

public class project
{
   public static void main(String[]args)
   {
       While  (we have money left to spend and (itemNumber <=max number of items))
       {
           Display amount of money left and number of items that can be bought.
           Read cost of proposed purchase if(we can afford the purchase)
           {
               Display a message.
               totalSpent = totalspent + cost of item
               update amountRemaining 
                       if(amountRemaining >0);
                       {
                           Display amount of money left.
                           itemNumber++
                                   }
                       {
                           else
                       }
 {
Display a message (no more money).
Make this the last loop interation
{
else
{
D
}
}

}

Recommended Answers

All 6 Replies

Member Avatar for LastMitch

check error input

What is the issue?

You never mention anything regarding what issue you are having with your code?

You just didn't mention it at all.

i cant get sample screen output . what wrong my input errors .. anyone can help me get the right code ..thank you

you may buy up to 3 items
costing no more than $100
enter cost of items #1: $80
you may buy this item
you spent $80 so far
you may buy up to 2 times
costing no more than $20
enter cost of items #2: $20
you may buy this item
you spent $100 so far
you are out of money
you spent $100, and are done shopping.

Member Avatar for LastMitch

i cant get sample screen output . what wrong my input errors .. anyone can help me get the right code ..thank you

What right code? You can't expect someone to write the whole code like what you explain?

sorry what i mean which of my code when wrong 

opp sorry first time in this forums....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.