Advertisement
202revenge

Fundraiser

Oct 12th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.93 KB | None | 0 0
  1. ===========================================================================================================================
  2. Fundraiser.java
  3. ===========================================================================================================================
  4. /*
  5.  *File name: Fundraiser.java
  6.  *
  7.  *Programmer: Derek Townsend
  8.  *ULID: djtown1
  9.  *
  10.  *Date: Oct 10, 2017
  11.  *
  12.  *Class: IT 168
  13.  *Lecture Section: 004
  14.  *Lecture Instructor:Dr Xing Fang
  15.  *Lab Section: 005
  16.  *Lab Instructor: Simran Kaur
  17.  */
  18. package edu.ilstu;
  19.  
  20. /*
  21.  *<insert description>
  22.  *
  23.  * @author Derek
  24.  *
  25.  */
  26. public class Fundraiser
  27. {
  28.     public final double PASTRY=13, COOKIE_DOUGH=22, TIER1=1.08, TIER2=1.15;
  29.     private int cinnamon, cheese, strawberry, chocolateChip, peanutButter=0;
  30.    
  31.     public int getCinnamon(){
  32.         return cinnamon;
  33.     }
  34.     public int getCheese(){
  35.         return cheese;
  36.     }
  37.     public int getStrawberry(){
  38.         return strawberry;
  39.     }
  40.     public int getChocolateChip(){
  41.         return chocolateChip;
  42.     }
  43.     public int getPeanutButter(){
  44.         return peanutButter;
  45.     }
  46.    
  47.     public double getPASTRY(){
  48.         return PASTRY;
  49.     }
  50.     public double getCOOKIE_DOUGH(){
  51.         return COOKIE_DOUGH;
  52.     }
  53.    
  54.     public double getTIER1(){
  55.         return TIER1;
  56.     }
  57.     public double getTIER2(){
  58.         return TIER2;
  59.     }
  60.    
  61.     public void setCinnamon(int cinnamon){
  62.         this.cinnamon=cinnamon;
  63.     }
  64.     public void setCheese(int cheese){
  65.         this.cheese=cheese;
  66.     }
  67.     public void setStrawberry(int strawberry){
  68.         this.strawberry=strawberry;
  69.     }
  70.     public void setChocolateChip(int chocolateChip){
  71.         this.chocolateChip=chocolateChip;
  72.     }
  73.     public void setPeanutButter(int peanutButter){
  74.         this.peanutButter=peanutButter;
  75.     }
  76.    
  77.    
  78.    
  79.     public double calculateSchoolShare(double totalCountPastry,double totalCountCookieDough) {
  80.        
  81.         if(totalCountPastry<10||totalCountCookieDough<5) {
  82.             return TIER1;
  83.         }else {
  84.             return TIER2;
  85.         }
  86.        
  87.        
  88.     }
  89.     public double calculatePastryCost() {
  90.         return cinnamon/cheese;
  91.     }
  92.     public double calculateCookieCost() {
  93.         return cinnamon/chocolateChip;
  94.     }
  95.     public double calculateNetCost() {
  96.         return cinnamon/strawberry;
  97.     }
  98.    
  99. }
  100. ===========================================================================================================================
  101. FundraiserApp.java
  102. ===========================================================================================================================
  103. /*
  104. w *File name: FundraiserApp.java
  105.  *
  106.  *Programmer: Derek Townsend
  107.  *ULID: djtown1
  108.  *
  109.  *Date: Oct 10, 2017
  110.  *
  111.  *Class: IT 168
  112.  *Lecture Section: 004
  113.  *Lecture Instructor:Dr Xing Fang
  114.  *Lab Section: 005
  115.  *Lab Instructor: Simran Kaur
  116.  */
  117. package edu.ilstu;
  118. import java.util.Scanner;
  119.  
  120. /*
  121.  *<insert description>
  122.  *
  123.  * @author Derek
  124.  *
  125.  */
  126. public class FundraiserApp
  127. {
  128.  
  129.     public static void main(String[] args)
  130.     {
  131.         Scanner scan = new Scanner(System.in);
  132.         Fundraiser school1=new Fundraiser();
  133.        
  134.         System.out.println("Welcome to the Pastry and Cookies Products\n");
  135.         System.out.println("Pastry\n\n"+"Cinnamon $"+school1.getPASTRY());
  136.         System.out.print("Cheese $"+school1.getPASTRY());
  137.         System.out.print("\nStrawberry $"+school1.getPASTRY());
  138.        
  139.         System.out.println("\n\nCookie Dough\n\n"+"Chocolate Chip $"+school1.getCOOKIE_DOUGH());
  140.         System.out.println("Peanut Butter $"+school1.getCOOKIE_DOUGH());
  141.        
  142.         System.out.print("\nEnter number of Cinnamon pastry: ");
  143.        
  144.         System.out.print("\nEnter number of Cheese pastry: ");
  145.        
  146.         System.out.print("\nEnter number of Strawberry pastry: ");  
  147.        
  148.         System.out.print("\nEnter number of Chocolate Chip cookie dough: ");  
  149.        
  150.         System.out.print("\nEnter number of Peanut Butter cookie dough: ");
  151.        
  152.         System.out.println("Order Summary\n"+"Order Counts");
  153.         System.out.println("Pastry\n\n"+"Cinnamon $"+school1.getPASTRY());
  154.         System.out.print("Cheese $"+school1.getPASTRY());
  155.         System.out.print("\nStrawberry $"+school1.getPASTRY());
  156.        
  157.         System.out.println("\n\nCookie Dough\n\n"+"Chocolate Chip $"+school1.getCOOKIE_DOUGH());
  158.     }
  159.  
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement