Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ===========================================================================================================================
- Fundraiser.java
- ===========================================================================================================================
- /*
- *File name: Fundraiser.java
- *
- *Programmer: Derek Townsend
- *ULID: djtown1
- *
- *Date: Oct 10, 2017
- *
- *Class: IT 168
- *Lecture Section: 004
- *Lecture Instructor:Dr Xing Fang
- *Lab Section: 005
- *Lab Instructor: Simran Kaur
- */
- package edu.ilstu;
- /*
- *<insert description>
- *
- * @author Derek
- *
- */
- public class Fundraiser
- {
- public final double PASTRY=13, COOKIE_DOUGH=22, TIER1=1.08, TIER2=1.15;
- private int cinnamon, cheese, strawberry, chocolateChip, peanutButter=0;
- public int getCinnamon(){
- return cinnamon;
- }
- public int getCheese(){
- return cheese;
- }
- public int getStrawberry(){
- return strawberry;
- }
- public int getChocolateChip(){
- return chocolateChip;
- }
- public int getPeanutButter(){
- return peanutButter;
- }
- public double getPASTRY(){
- return PASTRY;
- }
- public double getCOOKIE_DOUGH(){
- return COOKIE_DOUGH;
- }
- public double getTIER1(){
- return TIER1;
- }
- public double getTIER2(){
- return TIER2;
- }
- public void setCinnamon(int cinnamon){
- this.cinnamon=cinnamon;
- }
- public void setCheese(int cheese){
- this.cheese=cheese;
- }
- public void setStrawberry(int strawberry){
- this.strawberry=strawberry;
- }
- public void setChocolateChip(int chocolateChip){
- this.chocolateChip=chocolateChip;
- }
- public void setPeanutButter(int peanutButter){
- this.peanutButter=peanutButter;
- }
- public double calculateSchoolShare(double totalCountPastry,double totalCountCookieDough) {
- if(totalCountPastry<10||totalCountCookieDough<5) {
- return TIER1;
- }else {
- return TIER2;
- }
- }
- public double calculatePastryCost() {
- return cinnamon/cheese;
- }
- public double calculateCookieCost() {
- return cinnamon/chocolateChip;
- }
- public double calculateNetCost() {
- return cinnamon/strawberry;
- }
- }
- ===========================================================================================================================
- FundraiserApp.java
- ===========================================================================================================================
- /*
- w *File name: FundraiserApp.java
- *
- *Programmer: Derek Townsend
- *ULID: djtown1
- *
- *Date: Oct 10, 2017
- *
- *Class: IT 168
- *Lecture Section: 004
- *Lecture Instructor:Dr Xing Fang
- *Lab Section: 005
- *Lab Instructor: Simran Kaur
- */
- package edu.ilstu;
- import java.util.Scanner;
- /*
- *<insert description>
- *
- * @author Derek
- *
- */
- public class FundraiserApp
- {
- public static void main(String[] args)
- {
- Scanner scan = new Scanner(System.in);
- Fundraiser school1=new Fundraiser();
- System.out.println("Welcome to the Pastry and Cookies Products\n");
- System.out.println("Pastry\n\n"+"Cinnamon $"+school1.getPASTRY());
- System.out.print("Cheese $"+school1.getPASTRY());
- System.out.print("\nStrawberry $"+school1.getPASTRY());
- System.out.println("\n\nCookie Dough\n\n"+"Chocolate Chip $"+school1.getCOOKIE_DOUGH());
- System.out.println("Peanut Butter $"+school1.getCOOKIE_DOUGH());
- System.out.print("\nEnter number of Cinnamon pastry: ");
- System.out.print("\nEnter number of Cheese pastry: ");
- System.out.print("\nEnter number of Strawberry pastry: ");
- System.out.print("\nEnter number of Chocolate Chip cookie dough: ");
- System.out.print("\nEnter number of Peanut Butter cookie dough: ");
- System.out.println("Order Summary\n"+"Order Counts");
- System.out.println("Pastry\n\n"+"Cinnamon $"+school1.getPASTRY());
- System.out.print("Cheese $"+school1.getPASTRY());
- System.out.print("\nStrawberry $"+school1.getPASTRY());
- System.out.println("\n\nCookie Dough\n\n"+"Chocolate Chip $"+school1.getCOOKIE_DOUGH());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement