Guest User

Untitled

a guest
Dec 18th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. var COST_OF_SHIRTS;
  2. var stock = readInt("How many t-shirts do we have in stock");
  3.  
  4. function start(){
  5. while(stock>0){
  6. println("we have "+stock+ " number of tshirts in inventory");
  7. var numtobuy=readInt("how many tshirts would you like to buy");
  8. println("you will pay $"+numtobuy*COST_OF_SHIRTS);
  9. if(numtobuy<=stock){
  10. stock=stock-numtobuy;
  11. println("now we have "+stock+"tshirts");
  12. }else{
  13. println("sorry. there is not enough tshirts in stock for you to purchase.");
  14.  
  15. }
  16.  
  17. }
  18. println("we are all out of tshirts. we need to order more");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment