zafienas / SSK3100-G14

0 stars 0 forks source link

1) MyJava Coffee Outlet #9

Closed zafienas closed 3 years ago

zafienas commented 4 years ago

Problem Definition:

MyJava Coffee Outlet runs a catalog business. It sells only one type of coffee beans, harvested exclusively in the remote area of Seri Kembangan. The company sells the coffee 200 gram bags only, and the price of a single 200 gram bag is RM5.50. When a customer places an order, the company ships the order in boxes. The boxes come in three sizes: the large box holds 20 bags of 200 gram, the medium 10 bags, and the small 5 bags. The cost of a large box is RM1.80; a medium box is RM1.00; and a small box is RM0.60. The order is shipped using the least number of boxes. For example, the order of 52 bags will be shipped in four boxes: two large, one medium and one small.

Expected Output:

image

Submission:

  1. Input Process Output (IPO) chart
  2. Flowchart
  3. Pseudocode
  4. Java source code
  5. Screenshot of the output
Farhanazul98 commented 3 years ago

Java Coffee IPO chart image

Flowchart image image

Pseudocode image

Java Source Code

//Developer: Farhana Zulkhairi
//Task: Calculate Total cost of an order

import java.util.Scanner;
import java.text.DecimalFormat;

public class Coffee {
    public static void main(String [] args){

        int largeBox, mediumBox, smallBox, Coffeebag_order;
        double price_perBag, price_largeBox, price_mediumBox, price_smallBox;
        double Box_large, Box_medium, Box_small;
        double total_large, total_medium, total_small;
        double Total_orderBag, Total_priceBox, Total_cost;

        Scanner scanner = new Scanner(System.in);
        DecimalFormat decimal = new DecimalFormat("0");
        DecimalFormat dc = new DecimalFormat("0.00");

        largeBox = 20;
        mediumBox = 10;
        smallBox = 5;

        price_perBag = 5.50;
        price_smallBox = 0.60;
        price_mediumBox = 1.00;
        price_largeBox = 1.80;

        System.out.print("Number of coffee bags ordered = ");
        Coffeebag_order = scanner.nextInt();
        System.out.println("Total number bags ordered = " + "RM" + dc.format(price_perBag * Coffeebag_order));

        Box_large = Coffeebag_order / 20;
        Box_medium = (Coffeebag_order % 20) / 10;
        Box_small = (Coffeebag_order % 20 % 10) / 5;

        total_large = (price_largeBox * Box_large);
        total_medium = (price_mediumBox * Box_medium);
        total_small = (price_smallBox * Box_small);
        Total_orderBag = price_perBag * Coffeebag_order;
        Total_priceBox = + total_large + total_medium + total_small;

        Total_cost = Total_orderBag + Total_priceBox;

        System.out.println("Number of boxes used: ");
        System.out.println("\t");
        System.out.println(decimal.format(Box_large) + " Box Large = " + "RM" + dc.format(total_large));
        System.out.println(decimal.format(Box_medium) + " Box Medium = " + "RM" + dc.format(total_medium));
        System.out.println(decimal.format(Box_small) + " Box Medium = " + "RM" + dc.format(total_small));
        System.out.println("\t");
        System.out.println("Total cost of an order = RM" + dc.format(Total_cost));

    }
}

Output image

izzatisyahzanani16 commented 3 years ago

image

CoffeeBean

image


// Developer : Nurul Izzati Syahzanani Binti Farooq Azam
// Project : My Java Coffee Shop

import java.util.Scanner;

public class MyJavaCoffee {
    public static void main (String [] args) {

        int numberOfBag, smallBox, mediumBox, largeBox, balance, numberOfSmallBox = 0, numberOfMediumBox, numberOfLargeBox;
        double pricePerBag, priceLargeBox, priceMediumBox, priceSmallBox, totalPriceOfBoxes, totalPriceOfCoffeeBean;

        smallBox = 5;
        mediumBox = 10;
        largeBox = 20;

        pricePerBag = 5.50;
        priceSmallBox = 0.60;
        priceMediumBox = 1.00;
        priceLargeBox = 1.80;

        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter number of coffee bean bag: ");
        numberOfBag = scanner.nextInt();

        // numberOfBag = 52;

        //number of boxes used
        numberOfLargeBox = numberOfBag / largeBox;
        balance = numberOfBag % largeBox;

        numberOfMediumBox = balance / mediumBox;
        balance = balance % mediumBox;

        if (balance <= smallBox)
            numberOfSmallBox = balance / smallBox;{
                if ((balance % smallBox) > 0 )
                    numberOfSmallBox++;
                else
                    numberOfMediumBox++;
            }

        System.out.println("Large Box : " + numberOfLargeBox);
        System.out.println("Medium Box : " + numberOfMediumBox);
        System.out.println("Small Box : " + numberOfSmallBox );

        //price
        totalPriceOfCoffeeBean = pricePerBag * numberOfBag;
        totalPriceOfBoxes = (numberOfSmallBox * priceSmallBox) + (numberOfMediumBox * priceMediumBox) + (numberOfLargeBox * priceLargeBox);

        System.out.println("Coffee Bean Price = RM" + totalPriceOfCoffeeBean);
        System.out.println("Boxes Price = RM" + totalPriceOfBoxes);
        System.out.println("Total Price = RM" + (totalPriceOfBoxes + totalPriceOfCoffeeBean));
    }
}

image

DenzKaizer commented 3 years ago
//Developer : Danish
//Task : Coffee bean
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        int numbrtofBag, smallBox, mediumBox, largeBox, balance, numSmallBox, numMediumBox, numLargeBox;
        double price_PerBag, price_LargeBox, price_mediumBox, price_SmallBox, total_order, totalPriceBox, coffeePrice;

        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter quantity? = ");

        numbrtofBag = scanner.nextInt();

        largeBox = 20;
        mediumBox = 10;
        smallBox = 5;

        price_PerBag = 5.50;
        price_SmallBox = 0.60;
        price_mediumBox = 1.00;
        price_LargeBox = 1.80;

        numLargeBox = numbrtofBag / largeBox;
        balance = numbrtofBag % largeBox;

        numMediumBox = balance / mediumBox;
        balance = balance % mediumBox;

        numSmallBox = balance / smallBox;
        balance = balance % mediumBox;
        if ((balance % smallBox) > 0 )
            numSmallBox++;

        /*if (balance <= smallBox) {
            numSmallBox = balance / smallBox;
            if ((balance % smallBox) > 0)
                numSmallBox++;
        }
        else
            numMediumBox++;*/

        totalPriceBox = (numLargeBox * price_LargeBox) + (numMediumBox * price_mediumBox) + (numSmallBox * price_SmallBox);
        coffeePrice = (numbrtofBag * price_PerBag);
        total_order = coffeePrice + totalPriceBox;

        System.out.println("Order quantity : " + numbrtofBag);
        System.out.println("Total cost of " + numbrtofBag + " is : RM " + coffeePrice);

        System.out.println("Large box : " + numLargeBox);
        System.out.println("Medium Box : " + numMediumBox);
        System.out.println("Small Box : " + numSmallBox);

        System.out.println("Price or large Box : RM " + price_LargeBox * numLargeBox);
        System.out.println("Price of Medium Box : RM " + price_mediumBox * numMediumBox);
        System.out.println("Price of Small Box : RM " + price_SmallBox * numSmallBox);
        //System.out.println("Total price of box : RM " + ((price_LargeBox * numLargeBox) + (price_mediumBox + numMediumBox) + (price_SmallBox * numSmallBox)));
        System.out.println("Total price of all box : RM " + totalPriceBox);

        //System.out.println("Total order price : RM " + ((price_LargeBox * numLargeBox) + (price_mediumBox + numMediumBox) + (price_SmallBox * numSmallBox) + (numbrtofBag * price_PerBag)));
        System.out.println("Total Cost : Rm " + total_order );

    }
}

Screenshot_11 coffee Pesudeo code coffee COFFEE

FtyRzd commented 3 years ago

IPO CoffeeBean Lab2CoffeeBean Pseudocode CoffeeBean

//Developer : Siti Nurfatihah bt Rozaidi (202934)
//Task : Order of Coffee Bean
import java.util.Scanner;
import java.text.DecimalFormat;

public class CoffeeBean {
    public static void main(String[] args) {
        DecimalFormat df = new DecimalFormat("0.00");

        int NoOfBag,SmallBox,MediumBox,LargeBox,balance,numSmallBox,numMediumBox,numLargeBox;
        double price_PerBag,price_smallBox,price_mediumBox,price_largeBox,totalPrice_SmallBox,totalPrice_MediumBox,totalPrice_LargeBox,total_cost,total_boxprice;

        Scanner scanner = new Scanner(System.in);
        System.out.println(" Number of Bags Ordered: ");
        NoOfBag = scanner.nextInt();

        SmallBox = 5;
        MediumBox = 10;
        LargeBox = 20;

        price_PerBag = 5.50;
        price_smallBox = 0.60;
        price_mediumBox = 1.00;
        price_largeBox = 1.80;

        total_boxprice = NoOfBag * price_PerBag;
        System.out.println(" Number of Bags Ordered: " + NoOfBag + " - RM "+df.format(total_boxprice));

        System.out.println(" Boxes Used : \n ");

        numLargeBox = NoOfBag / LargeBox;
        balance = NoOfBag % LargeBox;
        totalPrice_LargeBox = price_largeBox * numLargeBox;
        System.out.println("\t\t\t"+numLargeBox +"\tLarge  - RM\t"+df.format(totalPrice_LargeBox));

        numMediumBox = balance / MediumBox;
        balance = balance % MediumBox;
        totalPrice_MediumBox = price_mediumBox * numMediumBox;
        System.out.println("\t\t\t"+numMediumBox +"\tMedium - RM\t"+df.format(totalPrice_MediumBox));

        numSmallBox = balance / SmallBox;
        if ((balance % SmallBox) > 0)
            numSmallBox++;
        else
            numMediumBox++;
        totalPrice_SmallBox = price_smallBox * numSmallBox;
        System.out.println("\t\t\t"+numSmallBox +"\tSmall  - RM\t"+df.format(totalPrice_SmallBox));

        totalPrice_SmallBox = price_smallBox * SmallBox;
        totalPrice_MediumBox = price_mediumBox * MediumBox;
        totalPrice_LargeBox = price_largeBox * LargeBox;

        total_cost = ((NoOfBag * price_PerBag)+(numLargeBox * price_largeBox)+(numMediumBox * price_mediumBox)+(numSmallBox*price_smallBox));
        System.out.println(" \n Your Total cost is: RM"+df.format(total_cost));
    }
}

output CoffeeBean

elyamaisarah commented 3 years ago
//Developer: Nurul Elya Maisarah binti Ishiam (202487)
import java.text.DecimalFormat;
import java.util.Scanner;
public class CoffeeBean {
       public static void main (String [] args){
           Scanner sc = new Scanner(System.in);

           int SmallBox, MediumBox, LargeBox, balance, numSmallbox, numMediumbox, numLargebox,numberOfbag;
           double price_Per_Bag, price_Smallbox, price_Mediumbox, price_Largebox, totalcost, totalb0xprice,totalpriceLarge, totalpriceMedium, totalpriceSmall;

           SmallBox = 5;
           MediumBox = 10;
           LargeBox = 20;

           price_Per_Bag = 5.50;
           price_Smallbox = 0.60;
           price_Mediumbox = 1.00;
           price_Largebox = 1.80;

           DecimalFormat df = new DecimalFormat("0.00");

           System.out.print("Number of bags ordered: ");
           numberOfbag = sc.nextInt();

           totalb0xprice = numberOfbag * price_Per_Bag;
           System.out.println("Number of bag ordered: " + numberOfbag + " - RM"+df.format(totalb0xprice));

           System.out.println("Box used : \n");

           numLargebox = numberOfbag / LargeBox;
           balance = numberOfbag % LargeBox;
           totalpriceLarge = price_Largebox * numLargebox;
           System.out.println( numLargebox +"\tLarge - RM\t"+df.format(totalpriceLarge));

           numMediumbox = balance / MediumBox;
           balance = balance % MediumBox;
           totalpriceMedium = price_Mediumbox * numMediumbox;
           System.out.println( numMediumbox +"\tMedium - RM\t"+df.format(totalpriceMedium));

           numSmallbox = balance / SmallBox;
           if ((balance % SmallBox) > 0 )
               numSmallbox++;
           else
               numMediumbox++;
           totalpriceSmall = price_Smallbox * numSmallbox;
           System.out.println(numSmallbox +"\tSmall - RM\t"+df.format(totalpriceSmall));

           totalcost =((totalb0xprice)+(totalpriceLarge)+(totalpriceMedium)+(totalpriceSmall));
           System.out.println("Total cost is:RM " + df.format(totalcost));
       }
}

IPO COFFEE PT 1 IPO COFFEE PT 2 FINAL COFFEE BEAN FC PSEUDOCODE COFFEE BEAN CODING COFFEE

NurHanisHaziqah commented 3 years ago

Screenshot_77 CoffeeBean

Screenshot_78

//Developer : Nur Hanis Haziqah Binti Hisham Haizad (202036)
import java.text.DecimalFormat;
import java.util.Scanner;

public class Coffee {
    public static void main (String [] args){
        int numOfBag,largeBox,mediumBox,smallBox,balance,numSmallBox,numMediumBox,numLargeBox;
        double price_perBag,price_largeBox,price_mediumBox,price_smallBox,total_ordered,totalPrice_smallBox,totalPrice_mediumBox,totalPrice_largeBox,total_Cost;
        DecimalFormat df = new DecimalFormat( "0.00");

        Scanner scanner = new Scanner( System.in);
        System.out.println(" Number of Bag Ordered: ");
        numOfBag = scanner.nextInt();

        smallBox = 5;
        mediumBox = 10;
        largeBox = 20;

        price_perBag = 5.50;
        price_smallBox = 0.60;
        price_mediumBox = 1.00;
        price_largeBox = 1.80;

        total_ordered = numOfBag * price_perBag;

        //Boxes used
        numLargeBox = numOfBag / largeBox;
        balance = numOfBag % largeBox;

        numMediumBox = balance / mediumBox;
        balance = balance % mediumBox;

        numSmallBox = balance / smallBox;
        if ((balance % smallBox) > 0 )
            numSmallBox++;

        else
            numMediumBox++;

        //Boxes price
        totalPrice_smallBox = price_smallBox * numSmallBox;
        totalPrice_mediumBox = price_mediumBox * numMediumBox;
        totalPrice_largeBox = price_largeBox * numLargeBox;

        total_Cost = (total_ordered) + (totalPrice_largeBox + totalPrice_mediumBox + totalPrice_smallBox);

        System.out.println( " Number of Bag Ordered = " +numOfBag + " - RM " +df.format(total_ordered));
        System.out.println( numLargeBox + " Large Box \t\t\t -RM " +df.format(totalPrice_largeBox));
        System.out.println( numMediumBox + " Medium Box \t\t\t -RM " +df.format(totalPrice_mediumBox));
        System.out.println( numSmallBox + " Small Box \t\t\t -RM " +df.format(totalPrice_smallBox));
        System.out.println( " Total Cost = RM " +df.format(total_Cost));

    }
}

Screenshot_79

fakhiraadriana commented 3 years ago
import java.text.DecimalFormat;
import java.util.Scanner;

public class Coffee {
    public static void main(String[]args) {

        int large_box,medium_box,small_box,newquantity,quantity;
        double totallarge,totalemedium,totalsmall,totalcoffee,totalorder,numberofbag,priceofcoffee,priceoflarge,priceofmedium,priceofsmall;

        priceofcoffee=5.50;
        priceoflarge=1.80;
        priceofmedium=1.00;
        priceofsmall=0.60 ;
        DecimalFormat df = new DecimalFormat("0.00");

        Scanner scanner = new Scanner(System.in);

        //user enter order quantity
        System.out.print("Order quantity= ");

        quantity=scanner.nextInt();

        large_box=quantity/20;
        newquantity=quantity%20;
        System.out.println("Number of large box =" + large_box);
        medium_box=newquantity/10;
        newquantity= newquantity%10;
        System.out.println("Number of medium box=" + medium_box);

        if (newquantity<=5) {
            small_box=newquantity/5;

            if((newquantity % 5) > 0)

            small_box=1;
        }
        else
            small_box=2;
        System.out.println("Number of small box =" + small_box +"\n");
        numberofbag = quantity*priceofcoffee ;
        System.out.println("Number of bag ordered = " + quantity + " :-RM" + df.format(numberofbag) );

        totallarge= large_box*priceoflarge ;
        totalemedium = medium_box*priceofmedium ;
        totalsmall = small_box * priceofsmall ;
        totalorder = totallarge + totalemedium + totalsmall + numberofbag ;
        System.out.println("Total cost of large box= RM" + df.format(totallarge) );
        System.out.println("Total cost of medium box= RM " + df.format(totalemedium));
        System.out.println("Total cost of small box = RM"+ df.format(totalsmall));
        System.out.println("Total cost of number of bags ordered= RM " + df.format(totalorder));
    }
}

Screenshot (98) Screenshot (117) Screenshot (118) Screenshot (120) Screenshot (121)

Masturah29 commented 3 years ago
// Developer : Masturah Binti Mokhtar
// Task : Coffee Beans

import java.util.Scanner;
import java.text.DecimalFormat;

public class coffee {
    public static void main(String[] args) {

        DecimalFormat df = new DecimalFormat("0.00");
        int large, medium, small, numlargebox, nummediumbox, numsmallbox,numbagordered, balance;
        double price_perbag, price_large_box, price_medium_box, price_small_box,total_price_bags_ordered, total_price_large_box, total_price_medium_box, total_price_small_box,total_cost;

        large = 20;
        medium = 10;
        small = 5;

        price_perbag = 5.50;
        price_large_box = 1.80;
        price_medium_box = 1.00;
        price_small_box = 0.60;

        Scanner scanner = new Scanner( System.in);
        System.out.print( "Enter number of bag ordered :");
        numbagordered = scanner.nextInt();

        total_price_bags_ordered = numbagordered * (+price_perbag);
        System.out.println(("= RM" + df.format(total_price_bags_ordered))+"\n\n");

        System.out.println(( "Box used")+"\n");

        numlargebox = numbagordered / + large;
        balance = numbagordered % large;
        total_price_large_box = numlargebox * price_large_box;
        System.out.println( numlargebox + "\tlarge - RM" + df.format(total_price_large_box));

        nummediumbox = +balance / medium;
        balance = +balance % medium;
        total_price_medium_box = nummediumbox * price_medium_box;
        System.out.println( nummediumbox + "\tmedium - RM" + df.format(total_price_medium_box));

        numsmallbox = +balance / small;

        if ((+balance % small) > 0)
            numsmallbox++;
        else
            nummediumbox++;

        total_price_small_box = (numsmallbox * price_small_box);
        System.out.println(numsmallbox + "\tsmall - RM\t" +df.format(total_price_small_box)+"\n");

        total_cost = total_price_bags_ordered + total_price_large_box + total_price_medium_box + total_price_small_box;
        System.out.println( "total cost = RM" + df.format(total_cost )+"\n");

    }

}

Pseudocode

Start

Declare large, medium, small, number of large box, number of medium box, number of small box, number of bags ordered, balance; price per bag, price large box, price medium box, price small box, total price bags ordered, total price large box, total price medium box, total price small box, and total cost Initialize large = 20, medium box = 10, and small = 5, price per bag =5.50, price large box = 1.80, the price medium box=1.00, and price small box = 0.60 Read the input from user the number of bags ordered Calculate total price bags ordered = number of bags orderedprice per bag
Calculate the number of large box = number of bags ordered/20 Calculate balance of large box = number of bags ordered % 20 Calculate total price of large box = number of large box
1.80 Calculate the number of medium box = balance of large box /10 Calculate the balance of medium box = balance of large box % 10 Calculate total price of medium box = number of medium boxprice medium box Calculate number of small box= balance of medium box/5 Calculate if balance of medium % 5) is more than 0, Display small box +1 Else Display medium box+1 Calculate total price small box = number of small box price small box Calculate total cost = Total price of 52 bags of coffee + Total price of large box + Total price of medium box + Total price of small box Print the number of bags ordered, number of large box, number of medium box, number of small box, total price of large box, total price of medium box, total price of small box, total cost.

End

ipo coffee ipo coffee 2

cofeeeee

arifqhuzairie commented 3 years ago
import java.text.DecimalFormat;
import java.util.Scanner;

// developer: arif qhuzairie
// task: myjava cofee outlet
public class coffeejava {
    public static void main(String[] args) {
        int largebox,mediumbox,smallbox,number_of_coffee_order,balance;
        double price_largebox,price_mediumbox,price_smallbox,price_coffee_ordered,price_perbag;
        double total_largebox,total_mediumbox,total_smallbox,total_box_used;
        double quantity_largebox,quantity_mediumbox,quantity_smallbox;

        Scanner scanner = new Scanner(System.in);
        DecimalFormat decimal = new DecimalFormat("0.00");
        DecimalFormat dec = new DecimalFormat("0");

        largebox = 20;
        mediumbox = 10;
        smallbox = 5;

        price_perbag = 5.50;
        price_largebox = 1.80;
        price_mediumbox = 1.00;
        price_smallbox = 0.60;

        System.out.println("number of coffee ordered");
        number_of_coffee_order = scanner.nextInt();

        price_coffee_ordered = number_of_coffee_order * price_perbag;

        quantity_largebox = number_of_coffee_order / largebox;
        balance = number_of_coffee_order % largebox;

        quantity_mediumbox = balance / mediumbox;
        balance = balance % mediumbox;

        quantity_smallbox = balance /smallbox;

        if ((balance % smallbox) > 0)
             quantity_smallbox++;

         else
             quantity_mediumbox++;

        total_largebox = (quantity_largebox*price_largebox);
        total_mediumbox = (quantity_mediumbox*price_mediumbox);
        total_smallbox = (quantity_smallbox*price_smallbox);
        total_box_used = (total_largebox + total_mediumbox + total_smallbox);

        System.out.println("price coffee ordered = RM " + (price_coffee_ordered));
        System.out.println("number of box used :");
        System.out.println((dec.format(quantity_largebox)) + " large box = RM " + (decimal.format(total_largebox)));
        System.out.println((dec.format(quantity_mediumbox)) + " medium box = RM " + (decimal.format(total_mediumbox)));
        System.out.println((dec.format(quantity_smallbox)) + " small box = RM " + (decimal.format(total_smallbox)));
        System.out.println("total cost of order = RM " + (price_coffee_ordered + total_box_used));

    }
    }

image image image image image image

SorfinaNorly commented 3 years ago

MyJava Coffee Outlet Chart MyJava Coffee Outlet MyJava Coffee Outlet Pseudocode

//Developer: Norshasha Sorfina
//Task: Coffee Beans

import java.text.DecimalFormat;
import java.util.Scanner;

public class MyJavaCoffeeOutlet {
    public static void main(String[] args){

        int numberOfBag, largeBox, mediumBox, smallBox, numLargeBox, numMediumBox, numSmallBox,balance;
        double price_perBag, price_LargeBox, price_MediumBox, price_SmallBox, total_bagprice, total_cost;

        DecimalFormat df = new DecimalFormat("0.00");

        //Number of bag in every box
        largeBox = 20;
        mediumBox = 10;
        smallBox = 5;

        //Price of boxes and bag
        price_LargeBox = 1.80;
        price_MediumBox = 1.00;
        price_SmallBox = 0.60;
        price_perBag = 5.50;

        //Input from user
        Scanner input = new Scanner(System.in);
        System.out.print("Enter number of coffee bean's bag:");
        numberOfBag = input.nextInt();

        //Calculate price of bags ordered
        (total_bagprice) = (numberOfBag * price_perBag);
        System.out.println("Number of bags ordered: " + numberOfBag + "- RM" + df.format(total_bagprice));

        //Calculate number of boxes
        numLargeBox = (numberOfBag / largeBox);
        balance = (numberOfBag % largeBox);
        numMediumBox = (balance / mediumBox);
        balance = (balance % mediumBox);
        numSmallBox = (balance / smallBox);

        if ((balance % smallBox) > 0)
            numSmallBox++;
        else
            numMediumBox++;

        //Calculate price of boxes
        price_LargeBox = (numLargeBox * price_LargeBox);
        price_MediumBox = (numMediumBox * price_MediumBox);
        price_SmallBox = (numSmallBox * price_SmallBox);

        //Display
        System.out.println( numLargeBox + " Large Box - RM " + df.format(price_LargeBox));
        System.out.println( numMediumBox + " Medium Box - RM " + df.format(price_MediumBox));
        System.out.println( numSmallBox + " Small Box - RM " + df.format(price_SmallBox));

        //TotalCost
        total_cost = (total_bagprice + price_LargeBox + price_MediumBox + price_SmallBox);
        System.out.println(" \nTotal Cost: RM " + df.format(total_cost));

    }
}

MyJava Coffee Outlet Output

nadiahisml commented 3 years ago

image image image image

//Developer: Nadiah Ismail
//Task: Calculate total cost of an order

import java.util.Scanner;

public class MyJavaCoffeeOutlet {
    public static void main(String [] args){
        Scanner input = new Scanner(System.in);

        double price_coffeeBag = 5.50,
                price_largeBox = 1.80,
                price_mediumBox = 1.00,
                price_smallBox = 0.60;

        int largeBox = 20,
                mediumBox = 10,
                smallBox = 5;

        double total_largeBox = 0,
                total_medBox = 0,
                total_smallBox = 0;

        System.out.println("Enter number of bags ordered ");
        int num_of_bags = input.nextInt();

        double total_price_of_bags = num_of_bags * price_coffeeBag;

        int numLargeBox = num_of_bags / largeBox;
        int remainder = num_of_bags % largeBox;

        int numMedBox = remainder / mediumBox;
        remainder = remainder % mediumBox;

        int numSmallBox = remainder / smallBox;
        remainder = remainder % smallBox;

        if (remainder > 0)
            numSmallBox++;

        System.out.printf("Number of Bags Ordered:%d - RM%.2f", num_of_bags, total_price_of_bags);
        System.out.println();
        System.out.println("Boxes Used:");

        if (numLargeBox > 0){
            total_largeBox = (double)numLargeBox * price_largeBox;
            System.out.printf("\t %d Large \t -RM%.2f", numLargeBox, total_largeBox);
            System.out.println();
        }

        if (numMedBox > 0){
            total_medBox = (double)numMedBox * price_mediumBox;
            System.out.printf("\t %d Medium \t -RM%.2f", numMedBox, total_medBox);
            System.out.println();
        }

        if (numSmallBox > 0){
            total_smallBox = (double)numSmallBox * price_smallBox;
            System.out.printf("\t %d Small \t -RM%.2f", numSmallBox, total_smallBox);
            System.out.println();
        }

        double total_cost = total_price_of_bags + total_largeBox + total_medBox + total_smallBox;

        System.out.printf("You Total cost is: RM%.2f", total_cost);
    }
}

image

haswani203024 commented 3 years ago
//Developer :NURUL HASWANI BT ARIFFIN

import java.text.DecimalFormat;
import java.util.Scanner;
public class Coffee {

    public static void main (String [] args){
        Scanner sc = new Scanner(System.in);

        int SmallBox, MediumBox, LargeBox, balance, numSmallbox, numMediumbox, numLargebox,numberOfbag;
        double price_Per_Bag, price_Smallbox, price_Mediumbox, price_Largebox, totalcost, totalb0xprice,totalpriceLarge, totalpriceMedium, totalpriceSmall;

        SmallBox = 5;
        MediumBox = 10;
        LargeBox = 20;

        price_Per_Bag = 5.50;
        price_Smallbox = 0.60;
        price_Mediumbox = 1.00;
        price_Largebox = 1.80;

        DecimalFormat df = new DecimalFormat("0.00");

        System.out.print("Number of bags ordered: ");
        numberOfbag = sc.nextInt();

        totalb0xprice = numberOfbag * price_Per_Bag;
        System.out.println("Number of bag ordered: " + numberOfbag + " - RM"+df.format(totalb0xprice));

        System.out.println("Box used : \n");

        numLargebox = numberOfbag / LargeBox;
        balance = numberOfbag % LargeBox;
        totalpriceLarge = price_Largebox * numLargebox;
        System.out.println( numLargebox +"\tLarge - RM\t"+df.format(totalpriceLarge));

        numMediumbox = balance / MediumBox;
        balance = balance % MediumBox;
        totalpriceMedium = price_Mediumbox * numMediumbox;
        System.out.println( numMediumbox +"\tMedium - RM\t"+df.format(totalpriceMedium));

        numSmallbox = balance / SmallBox;
        if ((balance % SmallBox) > 0 )
            numSmallbox++;
        else
            numMediumbox++;
        totalpriceSmall = price_Smallbox * numSmallbox;
        System.out.println(numSmallbox +"\tSmall - RM\t"+df.format(totalpriceSmall));

        totalcost =((totalb0xprice)+(totalpriceLarge)+(totalpriceMedium)+(totalpriceSmall));
        System.out.println("Total cost is:RM " + df.format(totalcost));
        }
    }

image

image

image

image

image image image image image

azeelahyasmin00 commented 3 years ago

image image

image image

image

// Developer : Azeelah Yasmin Bt Azlee
//Task : Calculate total cost 

import java.text.DecimalFormat;
import java.util.Scanner;
public class CoffeeBean {

    public static void main (String [] args){
        Scanner sc = new Scanner(System.in);

        int SmallBox, MediumBox, LargeBox, balance, numSmallbox, numMediumbox, numLargebox,numberOfbag;
        double price_Per_Bag, price_Smallbox, price_Mediumbox, price_Largebox, totalcost, totalb0xprice,totalpriceLarge, totalpriceMedium, totalpriceSmall;

        SmallBox = 5;
        MediumBox = 10;
        LargeBox = 20;

        price_Per_Bag = 5.50;
        price_Smallbox = 0.60;
        price_Mediumbox = 1.00;
        price_Largebox = 1.80;

        DecimalFormat df = new DecimalFormat("0.00");

        System.out.print("Number of bags ordered: ");
        numberOfbag = sc.nextInt();

        totalb0xprice = numberOfbag * price_Per_Bag;
        System.out.println("Number of bag ordered: " + numberOfbag + " - RM"+df.format(totalb0xprice));

        System.out.println("Box used : \n");

        numLargebox = numberOfbag / LargeBox;
        balance = numberOfbag % LargeBox;
        totalpriceLarge = price_Largebox * numLargebox;
        System.out.println( numLargebox +"\tLarge - RM\t"+df.format(totalpriceLarge));

        numMediumbox = balance / MediumBox;
        balance = balance % MediumBox;
        totalpriceMedium = price_Mediumbox * numMediumbox;
        System.out.println( numMediumbox +"\tMedium - RM\t"+df.format(totalpriceMedium));

        numSmallbox = balance / SmallBox;
        if ((balance % SmallBox) > 0 )
            numSmallbox++;
        else
            numMediumbox++;
        totalpriceSmall = price_Smallbox * numSmallbox;
        System.out.println(numSmallbox +"\tSmall - RM\t"+df.format(totalpriceSmall));

        totalcost =((totalb0xprice)+(totalpriceLarge)+(totalpriceMedium)+(totalpriceSmall));
        System.out.println("Total cost is:RM " + df.format(totalcost));
    }
}

image

image

NoorHusna202271 commented 3 years ago
import java.util.Scanner;

//Developer: Noor Husna
//Task: Price cost for coffee beans
public class Problem1 {
    public static void main (String[]args){
        int number_of_bag_order, Largerbox, Mediumbox, Smallbox, balance, numLargerbox, numMediumbox, numSmallbox;
        double Price_per_bag, Price_of_Largerbox, Price_of_Mediumbox, Price_of_Smallbox, Total_priceofbags,Total_priceofbox, Total_Cost;

        Scanner scanner = new Scanner(System.in);

        Largerbox= 20;
        Mediumbox= 10;
        Smallbox= 5;

        Price_per_bag= 5.50;
        Price_of_Largerbox= 1.80;
        Price_of_Mediumbox= 1.00;
        Price_of_Smallbox= 0.60;

        System.out.println("Enter number_of_bag_order" );

        number_of_bag_order= 55;
        System.out.println(" Number of bag order =" +number_of_bag_order +"bags");

        numLargerbox= number_of_bag_order/ Largerbox; // 55/20=2
        balance = number_of_bag_order % Largerbox; // 55 % 20 = 15
        System.out.println("Number of Larger box use =" +numLargerbox + "box");

        numMediumbox= balance / Mediumbox; // 15/10=1
        balance= balance % Mediumbox; // 15 % 10= 5
        System.out.println(" Number of Medium box user=" + numMediumbox + "box");

        numSmallbox= balance/ Smallbox; // 5/5= 1
        balance= balance % Smallbox; // 5 % 5= 0
        System.out.println(" Number of Small box user=" + numSmallbox + "box");

        Total_priceofbags= number_of_bag_order * Price_per_bag;
        Total_priceofbox= (numLargerbox * Price_of_Largerbox) + (numMediumbox * Price_of_Mediumbox) + (numSmallbox * Price_of_Smallbox);
        Total_Cost= Total_priceofbags + Total_priceofbox;

        System.out.println("Total price of bags= RM" + Total_priceofbags);
        System.out.println("Total price of box= RM" + Total_priceofbox);
        System.out.println("Total Cost= RM" + Total_Cost);

        if (balance < Smallbox) {
            numSmallbox = balance / Smallbox;
            if ((balance % Smallbox) > 0) ;
            numSmallbox++;
        }
        else
            numMediumbox++;

    }
}

image https://prnt.sc/vmotzi https://prnt.sc/vmpp1a

WanNurfarah commented 3 years ago

cb (26) FLOWCHART: CoffeBeans2

cb(27) JAVA SOURCE CODE:

//Developer: Wan Nurfarah Binti Wan Zulkifli
//Task: Calculate Total Cost of Coffee Beans

import java.text.DecimalFormat;
import java.util.Scanner;

public class CoffeeBeans {

        public static void main (String [] args){

            int numberOfBag,smallBox, mediumBox, largeBox, balance,numSmallBox=0, numMediumBox=0, numLargeBox=0;
            double price_PerBag, price_small, price_medium, price_large, total_large, total_medium, total_small, total_price, total_order, total_cost;

            smallBox= 5;
            mediumBox= 10;
            largeBox = 20;

            price_PerBag = 5.50;
            price_small = 0.60;
            price_medium = 1.00;
            price_large = 1.80;

            DecimalFormat df= new DecimalFormat ("0.00");

            Scanner scanner = new Scanner (System.in);
            System.out.print("Number of Bags Ordered = ");
            numberOfBag = scanner.nextInt();

            numLargeBox = numberOfBag / largeBox;
            balance = numberOfBag % largeBox;

            numMediumBox = balance / mediumBox;
            balance = balance % mediumBox;

            if (balance <= smallBox){
                numSmallBox = balance / smallBox;
                if ((balance % smallBox ) > 0 )
                    numSmallBox++;

            }
            else
                numMediumBox++;

            total_order = numberOfBag * price_PerBag;
            System.out.println("Total Price of Bags Ordered = RM " + df.format(total_order) + "\n");

            total_large = numLargeBox * price_large;
            total_medium = numMediumBox * price_medium;
            total_small = numSmallBox * price_small;
            total_price = total_large + total_medium + total_small;

            System.out.println("Number of Boxes Used : \n");
            System.out.println(numLargeBox + " Large Box : RM " + df.format(total_large) );
            System.out.println(numMediumBox + " Medium Box : RM " + df.format(total_medium));
            System.out.println(numSmallBox + " Small Box : RM " + df.format(total_small) + "\n");

            total_cost = total_order + total_price;
            System.out.println("Total Cost of Coffee Beans = RM " + df.format(total_cost));
        }
    }

OUTPUT: cb(24)

ikmalhafiq commented 3 years ago

Screenshot 2020-11-20 212339 Screenshot 2020-11-20 212557 Screenshot 2020-11-20 213845 unnamed4



// Developer : Ikmal Hafiq
//Task : Coffee

import java.util.Scanner;
import java.text.DecimalFormat;

public class coffee {
    public static void main(String [] args) {

        int numberofbag, smallbox, mediumbox, largebox, numSmallbox , numMediumbox, numLargebox, balance;
        double price_perbag, price_largebox, price_mediumbox, price_smallbox, coffeePrice, total_order, total_price;

        Scanner scanner = new Scanner(System.in);
        DecimalFormat dc = new DecimalFormat("0.00");
        System.out.print("Enter quantity? = ");

        numberofbag = scanner.nextInt();

        smallbox = 5;
        mediumbox = 10;
        largebox = 20;

        price_perbag = 5.50;
        price_smallbox = 0.60;
        price_mediumbox = 1.00;
        price_largebox = 1.00;

        numLargebox = numberofbag / largebox;
        balance = numberofbag % largebox;

        numMediumbox = balance / mediumbox;
        balance = balance % mediumbox;

        numSmallbox = balance / smallbox;
        balance = balance % smallbox;
        if ((balance % smallbox) > 0 )
            numSmallbox++;

        /* (balance <= small_box) {
            total_small_box = balance / small_box;
            if ((balance % small_box) > 0)
                total_small_box++;
        }
        else
            total_medium_box++; */

        total_price= (numLargebox * price_largebox) + (numMediumbox * price_mediumbox) + (numSmallbox * price_smallbox);
        coffeePrice = (numberofbag * price_perbag);
        total_order = coffeePrice + total_price;

        System.out.println("\nTotal cost of " + coffeePrice + " coffee bags is\t" + "RM" + dc.format(coffeePrice) + "\n");

        System.out.println("Order quantity \t\t\t= " + coffeePrice);
        System.out.println("Number of large box \t= " + numLargebox);
        System.out.println("Number of medium box \t= " + numMediumbox);
        System.out.println("Number of small box \t= " + numSmallbox + "\n");

        System.out.println("Total cost of all boxes = " + "RM" + dc.format(total_price));
        System.out.println("\t\t\t Total cost = RM" + dc.format(total_order));

    }
}
AzimArifin commented 3 years ago

//Developer: Azim
//Task: Coffee bag

import java.text.DecimalFormat;
import java.util.Scanner;

public class CoffeBag{
    public static void main (String[] args){

            int numberOfBag,smallBox,mediumbox,largeBox,balance, numsmallbox,numMediumbox,numLargeBox;
            double price_Perbag,price_largebox,price_mediumbox,price_smallbox,total_order,total_price,coffeePrice;

        Scanner scanner = new Scanner(System.in);
        DecimalFormat decimal = new DecimalFormat("0");
        DecimalFormat dc = new DecimalFormat("0.00");
        System.out.print(" Number of bag ordered= ");

        numberOfBag= scanner.nextInt();

            smallBox = 5;
            mediumbox= 10;
            largeBox =20;

            price_Perbag = 5.50;
            price_smallbox = 0.60;
            price_mediumbox = 1.00;
            price_largebox = 1.80;

           numLargeBox=numberOfBag/largeBox;
           balance= numberOfBag%largeBox;

            numMediumbox=balance/smallBox;
            balance=balance%mediumbox;

        numsmallbox = balance / smallBox;
        balance = balance % smallBox;
        if ((balance % smallBox) > 0 )
            numsmallbox++;

        /* (balance <= small_box) {
            total_small_box = balance / small_box;
            if ((balance % small_box) > 0)
                total_small_box++;
        }
        else
            total_medium_box++; */

        total_price= (numLargeBox * price_largebox) + (numMediumbox * price_mediumbox) + (numsmallbox * price_smallbox);
        coffeePrice = (numberOfBag * price_Perbag);
        total_order = coffeePrice + total_price;

        System.out.println("\nTotal cost of " + coffeePrice + " coffee bags is\t" + "RM" + dc.format(coffeePrice) + "\n");

        System.out.println("Order quantity \t\t\t= " + coffeePrice);
        System.out.println("Number of large box \t= " + numLargeBox);
        System.out.println("Number of medium box \t= " + numMediumbox);
        System.out.println("Number of small box \t= " + numsmallbox + "\n");

        System.out.println("Total cost of all boxes = " + "RM" + dc.format(total_price));
        System.out.println("\t\t\t Total cost of an order = RM" + dc.format(total_order));

    }

}
AzimArifin commented 3 years ago

coffebox pseudo coffebag output coffee bag ipo

shazmi10 commented 3 years ago
//Developer : Muhammad Shazmi Bin Mohd Basri
// Task : Calculate the total cost

import java.text.DecimalFormat;
import java.util.Scanner;

public class CoffeeBeans {
    public static void main (String [] args) {

        int largeBox,mediumBox,smallBox,coffeeBagOrder,balance;
        double price_largeBox,price_mediumBox,price_smallBox,price_coffee_ordered,price_perBag;
        int total_largeBox, total_mediumBox, total_smallBox, total_box_used;
        double total_boxPrice, totalPrice_largeBox, totalPrice_mediumBox, totalPrice_smallBox, total_cost;

        Scanner scanner = new Scanner(System.in);
        DecimalFormat df = new DecimalFormat("0.00");

        smallBox= 5;
        mediumBox= 10;
        largeBox = 20;

        price_perBag = 5.50;
        price_smallBox = 0.60;
        price_mediumBox = 1.00;
        price_largeBox = 1.80;

        System.out.print("Number of Bags Ordered = ");
        coffeeBagOrder = scanner.nextInt();

        total_boxPrice = coffeeBagOrder * price_perBag;
        System.out.println(" Number of Bags Ordered: " + coffeeBagOrder + " - RM "+df.format(total_boxPrice));

        System.out.println(" Boxes Used : \n ");

        total_largeBox = coffeeBagOrder / largeBox;
        balance = coffeeBagOrder % largeBox;
        totalPrice_largeBox = price_largeBox * total_largeBox;
        System.out.println("\t\t\t"+total_largeBox +"\tLarge  - RM\t"+df.format(totalPrice_largeBox));

        total_mediumBox = balance / mediumBox;
        balance = balance % mediumBox;
        totalPrice_mediumBox = price_mediumBox * total_mediumBox;
        System.out.println("\t\t\t"+total_mediumBox +"\tMedium - RM\t"+df.format(totalPrice_mediumBox));

        total_smallBox = balance / smallBox;
        if ((balance % smallBox) > 0)
            total_smallBox++;
        else
            total_mediumBox++;
        totalPrice_smallBox = price_smallBox * total_smallBox;
        System.out.println("\t\t\t"+total_smallBox +"\tSmall  - RM\t"+df.format(totalPrice_smallBox));

        totalPrice_smallBox = price_smallBox * smallBox;
        totalPrice_mediumBox = price_mediumBox * mediumBox;
        totalPrice_largeBox = price_largeBox * largeBox;

        total_cost = ((coffeeBagOrder * price_perBag) + (total_largeBox * price_largeBox) + (total_mediumBox * price_mediumBox)+(total_smallBox * price_smallBox));
        System.out.println(" \n Your Total cost is: RM"+df.format(total_cost));
    }
}

image unnamed1 image image

Syazimah06 commented 3 years ago
//Developer: Siti Nur Syazimah Binti Abu (203023)
//Task: Calculate total cost ordered coffee beans

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        int numberofBag, smallBox, mediumBox, largeBox, balance, numSmallBox, numMediumBox, numLargeBox;
        double price_PerBag, price_LargeBox, price_mediumBox, price_SmallBox, total_order, totalPriceBox, coffeePrice;

        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter Quantity = ");

        numberofBag = scanner.nextInt();

        largeBox = 20;
        mediumBox = 10;
        smallBox = 5;

        price_PerBag = 5.50;
        price_SmallBox = 0.60;
        price_mediumBox = 1.00;
        price_LargeBox = 1.80;

        numLargeBox = numberofBag / largeBox;
        balance = numberofBag % largeBox;

        numMediumBox = balance / mediumBox;
        balance = balance % mediumBox;

        numSmallBox = balance / smallBox;
        balance = balance % mediumBox;
        if ((balance % smallBox) > 0 )
            numSmallBox++;

        /*if (balance <= smallBox) {
            numSmallBox = balance / smallBox;
            if ((balance % smallBox) > 0)
                numSmallBox++;
        }
        else
            numMediumBox++;*/

        totalPriceBox = (numLargeBox * price_LargeBox) + (numMediumBox * price_mediumBox) + (numSmallBox * price_SmallBox);
        coffeePrice = (numberofBag * price_PerBag);
        total_order = coffeePrice + totalPriceBox;

        System.out.println("Total cost for " + numberofBag + " is : RM " + coffeePrice);

        System.out.println("Large box : " + numLargeBox);
        System.out.println("Medium Box : " + numMediumBox);
        System.out.println("Small Box : " + numSmallBox);

        System.out.println("Price of large Box : RM " + price_LargeBox * numLargeBox);
        System.out.println("Price of Medium Box : RM " + price_mediumBox * numMediumBox);
        System.out.println("Price of Small Box : RM " + price_SmallBox * numSmallBox);

        System.out.println("Total price of all box : RM " + totalPriceBox);

        System.out.println("Total Cost : Rm " + total_order );

    }
}

Output CoffeeBean CoffeeBeans flowchart IPO CoffeeBean Pseudocode CoffeeBean

nrhzrhrsli commented 3 years ago
//Developer : Hazirah
//Task : Coffee outlet

import java.util.Scanner;

public class coffeoutlet {
    public static void main (String [] args){

        int number_of_bag, smallbox, mediumbox, largebox, Number_Small_Box, Number_Medium_Box, Number_Large_Box, balance;
        double price_per_bag, price_largebox, price_mediumbox, price_smallbox, total_order, total_price, total_cost;

        smallbox = 5;
        mediumbox = 10;
        largebox = 20 ;

        price_per_bag = 5.50;
        price_smallbox = 0.60;
        price_mediumbox = 1.00;
        price_largebox = 1.80;

        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter quantity : ");
        number_of_bag = scanner.nextInt();

        Number_Large_Box = number_of_bag / largebox;
        balance = number_of_bag % largebox;

        Number_Medium_Box = balance / mediumbox;
        balance = balance % mediumbox;

        Number_Small_Box = balance / smallbox;
        balance = balance % mediumbox;

        if ((balance % smallbox) > 0);
             Number_Small_Box++;

        /*if (balance <= smallbox) {
            Number_Small_Box = balance / smallbox;
            if ((balance % smallbox) > 0)
            Number_Small_Box++;
        }
        else
            Number_Medium_Box++;*/

        System.out.println("Number Large Box = " + Number_Large_Box);
        System.out.println("Number Medium Box = " + Number_Medium_Box);
        System.out.println("Number Small Box = " + Number_Small_Box);

        System.out.println("Price Large Box = RM " + price_largebox * Number_Large_Box);
        System.out.println("Price Medium Box = RM " + price_mediumbox * Number_Medium_Box);
        System.out.println("Price Small Box = RM " + price_smallbox * Number_Small_Box);

        total_price = (Number_Large_Box * price_largebox) + (Number_Medium_Box * price_mediumbox) + (Number_Small_Box * price_smallbox);
        System.out.println( "Total price = RM " + total_price);
        total_order = (number_of_bag * price_per_bag);
        System.out.println("Total order = RM " + total_order);
        total_cost = total_order + total_price;
        System.out.println("Total cost = RM " + total_cost);

    }
}

image

image

image

jadi

FarhanaYusri commented 3 years ago
//Developer: Farhana Yusri
//Task: Calculate Total Cost

public class MYJAVA {

        public static void main(String [] args) {

            int numberOfBag, largeBox, mediumBox, smallBox, numLargeBox, numMediumBox, numSmallBox,balance;
            double price_perBag, price_LargeBox, price_MediumBox, price_SmallBox, total_bagprice, total_cost;

            DecimalFormat df = new DecimalFormat("0.00");

            //Number of bag in every box
            largeBox = 20;
            mediumBox = 10;
            smallBox = 5;

            //Price of boxes and bag
            price_LargeBox = 1.80;
            price_MediumBox = 1.00;
            price_SmallBox = 0.60;
            price_perBag = 5.50;

            //Input from user
            Scanner input = new Scanner(System.in);
            System.out.print("Enter number of coffee bean's bag:");
            numberOfBag = input.nextInt();

            //Calculate price of bags ordered
            (total_bagprice) = (numberOfBag * price_perBag);
            System.out.println("Number of bags ordered: " + numberOfBag + "- RM" + df.format(total_bagprice));

            //Calculate number of boxes
            numLargeBox = (numberOfBag / largeBox);
            balance = (numberOfBag % largeBox);
            numMediumBox = (balance / mediumBox);
            balance = (balance % mediumBox);
            numSmallBox = (balance / smallBox);

            if ((balance % smallBox) > 0)
                numSmallBox++;
            else
                numMediumBox++;

            //Calculate price of boxes
            price_LargeBox = (numLargeBox * price_LargeBox);
            price_MediumBox = (numMediumBox * price_MediumBox);
            price_SmallBox = (numSmallBox * price_SmallBox);

            //Display
            System.out.println( numLargeBox + " Large Box - RM " + df.format(price_LargeBox));
            System.out.println( numMediumBox + " Medium Box - RM " + df.format(price_MediumBox));
            System.out.println( numSmallBox + " Small Box - RM " + df.format(price_SmallBox));

            //TotalCost
            total_cost = (total_bagprice + price_LargeBox + price_MediumBox + price_SmallBox);
            System.out.println(" \nTotal Cost: RM " + df.format(total_cost));

        }
}

FLOWCHART MYJAVA IPO MYJAVA 1 IPO MYJAVA 2 OUTPUT MYJAVA PSEUDOCODE MYJAVA

Lyanaazwanis99 commented 3 years ago
public class Javacoffeebean {
    public static void main (String [] args){

        int number_of_bag_order,Largebox, Mediumbox, Smallbox, balance, numlargebox, nummediumbox, numsmallbox;
        double Price_per_bag, Price_of_Largebox, Price_of_Mediumbox, Price_of_Smallbox, Total_pricebags, Total_pricebox, Total_cost;

        Largebox= 20;
        Mediumbox= 10;
        Smallbox= 5;

        Price_per_bag = 5.50;
        Price_of_Largebox = 1.80;
        Price_of_Mediumbox = 1.00;
        Price_of_Smallbox = 0.60;
        number_of_bag_order = 55;

        System.out.println("number of bag order" + number_of_bag_order + "bags");
        numlargebox = number_of_bag_order/ Largebox;//(55/20)
        balance = number_of_bag_order % Largebox;//(55%/20)
        System.out.println("number of largebox used =" + numlargebox);
        nummediumbox = balance / Mediumbox;//(15/10)
        balance = balance % Mediumbox;//(15%10)
        System.out.println("number of mediumbox used" + nummediumbox);
        numsmallbox = balance / Smallbox;//(5/5)
        balance = balance % Smallbox;//(5%5)
        System.out.println("number of smallbox used" + numsmallbox);

        Total_pricebags = number_of_bag_order * Price_per_bag;
        System.out.println("Total of pricebags =" + Total_pricebags);
        Total_pricebox = (numlargebox * Price_of_Largebox) + (nummediumbox * Price_of_Mediumbox) + (numsmallbox * Price_of_Smallbox);
        System.out.println("Total of pricebox =" + Total_pricebox);
        Total_cost = Total_pricebags + Total_pricebox;
        System.out.println("Total cost of order  = RM" + Total_cost);

        if (balance < Smallbox){
            balance = balance % Smallbox;
            if((balance % Smallbox)> 0);
            numsmallbox++;
        }
        else
            nummediumbox++;
    }
}

https://prnt.sc/vnd9qr

https://prnt.sc/vnda60

https://prnt.sc/vndaxh

Yazidrahman commented 3 years ago

java // DEVELOPER YAZID RAHMAN //204608 import java.util.Scanner;

public class lab2coffee {

public static void main (String [] args) {
    int numberofBag, smallBox, mediumBox, largeBox, balance, numSmallBox, numMediumBox, numLargeBox;
    double price_PerBag, price_LargeBox, price_mediumBox, price_SmallBox, total_order, totalPriceBox, coffeePrice;

    Scanner scanner = new Scanner(System.in);
    System.out.print("Please enter quantity = ");

    numberofBag = scanner.nextInt();

    largeBox = 20;
    mediumBox = 10;
    smallBox = 5;

    price_PerBag = 5.50;
    price_SmallBox = 0.60;
    price_mediumBox = 1.00;
    price_LargeBox = 1.80;

    numLargeBox = numberofBag / largeBox;
    balance = numberofBag % largeBox;

    numMediumBox = balance / mediumBox;
    balance = balance % mediumBox;

    numSmallBox = balance / smallBox;
    balance = balance % mediumBox;

    if ((balance % smallBox) > 0)
        numSmallBox++;

    totalPriceBox = (numLargeBox * price_LargeBox) + (numMediumBox * price_mediumBox) + (numSmallBox * price_SmallBox);
    coffeePrice = (numberofBag * price_PerBag);
    total_order = coffeePrice + totalPriceBox;

    System.out.println("Order quantity : " +numberofBag );
    System.out.println("Total cost of coffee bag " + numberofBag + " is : RM " + coffeePrice);

    System.out.println("Large box : " + numLargeBox);
    System.out.println("Medium Box : " + numMediumBox);
    System.out.println("Small Box : " + numSmallBox);

    System.out.println("Price or large Box : RM " + price_LargeBox * numLargeBox);
    System.out.println("Price of Medium Box : RM " + price_mediumBox * numMediumBox);
    System.out.println("Price of Small Box : RM " + price_SmallBox * numSmallBox);

    System.out.println("Total price of  box : RM " + totalPriceBox);

    System.out.println("Total Cost : Rm " + total_order );

}

}

image

flow chart coffe yazid

Pseudo code YAZID RAHMAN 204608 Start Read from user number of bags ordered Declare large box, medium box and small box, price per bag ordered, price of large box, price of medium box, and price of small box as a double Declare quantity for each box large box – 20, medium box = 10, small box = 5, price per bag = 5.50, price of large box = 1.80, price of medium box = 1.00, price of small box = 0.6 Calculate number of large box = number of bags ordered / 20 Balance = number of bags ordered % 20 Calculate number of medium box = balanced / 10 Balance = balance from the large box % 10 Calculate number of small box = balance / 5 Balance = balance from the medium box % 5 If ((balance % small box) > 0) Calculate number of small box++ Calculate total price of large box = (number of large box price of large box) Calculate total price of medium box = (number of medium box price of medium box) Calculate total price of small box = (number of small box * price of small box) Calculate total cost of order = (total price of coffee bags ordered + total price of boxes used) Print total ordered coffee bags, price of boxed used, total cost of the order End