jam/Yogurt

From ggc

Jump to: navigation, search

Steps for solving the problem:

  1. Write a program that says "Add you code here."
  2. Revise to say "Welcome to Jam's Yogurt Shop."
  3. Revise to also say "How many ounces are in the first yogurt?"
  4. Read in the ounces, and report back what was put in
  5. Ask for second yogurt size and report back what was put in
  6. Report the total ounces
  7. Report the full price of the yogurt assuming no coupon
  8. Deduct the price of 8 ounces every time
  9. Deduct the price of 8 ounces only if they buy more than 16 ounces
  10. Report the price correctly if they buy 8 or more ounces
  11. Report the price for any ounces.

01 package jam;
02 import java.util.*;
03 import wiki.Wiki;
04 /**
05  * All about my application here.
06  @author Jam Jenkins
07  */
08 public class Yogurt
09 {
10   public static void main(String[] args)
11   {
12     Wiki.out.println("Welcome to Jam's Yogurt Shop.");
13     Wiki.out.println("How many ounces are in the first yogurt?");
14     Scanner scanner=new Scanner(Wiki.in);
15     double first=scanner.nextDouble();
16     Wiki.out.println("Your first yogurt is "+first+" ounces.");
17     Wiki.out.println("How many ounces are in the second yogurt?");
18     double second=scanner.nextDouble();
19     Wiki.out.println("Your second yogurt is "+second+" ounces.");
20     Wiki.out.println("Your yogurt total is "+(first+second)+" ounces.");
21     double price=(first+second)*0.39;
22     Wiki.out.println("Your cost is $"+price);
23   }
24 }


Download/View jam/Yogurt.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter