Sunday, August 5, 2012

Gum balls and Candy bars coupons in Java

/*
* Description: Write a program that defines a variable initially
* assigned to the number of coupons you win.
* Then , The program should output how many candy bars and gum balls
* you can get if you spend all of your coupons on candy bars first,
* and remaining coupons on gum balls.
*/
public class Coupons {


public static void main(String[] args) {

// Declare a variable indicating the Number of Tickets you won.
int numberoftickets;
numberoftickets = 49;
// Declare a variable indicating the number of Candy Bars you
//can get from the tickets you have
int candybars;
candybars = (numberoftickets/10);
//Declare a variable indicating the numbers of the left tickets.
int lefttickets;
lefttickets = (numberoftickets%10);
//Declare a variable indicating the numebr of gum balls you can get from the left tickets.
int gumballs;
gumballs = (lefttickets/3);

// use the println command to write the number of candybars and gumbballs you can get.
System.out.println("The Total Number of Candy Bars is = " + candybars);
System.out.println("The Total Number of Gum Balls is = " + gumballs);

}
//end.

}

1 comment:

  1. Also keep in mind that stores often let you use manufacturers coupons with your store Reebok Coupon Promo Code card savings. Be sure to check the coupon policies before taking this for granted though,

    ReplyDelete