Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
2.6 kB
1
Indexable
Never
import java.util.Scanner;


public class MaizePiemers {
    
    public static void main(String[] args) {
        //1) Data Type 2) Naming  3) Give Value
        //Bread Nr.1
        String tips = "white";
        byte expiringDay = 8;
        byte expiringMonth = 9;
        short expiringYear = 2021;
        boolean isSliced = true; //false
        String manufacturer = "Latvia";
        short weight = 500;//grams
        float price = 0.43f;//eur
        short nutrients = 433;//kcal
        System.out.print("The bread type is: " + tips + "\nThe expiring day is: " + expiringDay + "\nThe expiring month is: " + expiringMonth + "\nThe expiring year is: " + expiringYear + "\nThe bread is sliced: " + isSliced + "\nThe manufacturing country is: " + manufacturer + "\nThe weight is: " + weight + "\nThe price is: " + price + "\nThe nutrient value is: " + nutrients + "\n");
        
        // Tidying up the console
        System.out.print("\n--------------------------");
        
        //Bread Nr.2
        Scanner myScanner = new Scanner(System.in);
        System.out.print("\n\nEnter the type of bread: ");
        String tips2 = myScanner.next();

        System.out.print("Enter the bread expiring day: "); 
        byte expiringDay2 = myScanner.nextByte();

        System.out.print("Enter the expiring month: ");
        byte expiringMonth2 = myScanner.nextByte();
        
        System.out.print("Enter the expiring year: ");
        short expiringYear2 = myScanner.nextShort();      

        System.out.print("Is the bread sliced? (true/false): ");
        boolean isSliced2 = myScanner.nextBoolean();

        System.out.print("Enter the manufacturing country: ");
        String manufacturer2 = myScanner.next();

        System.out.print("Enter the weight: ");
        short weight2 = myScanner.nextShort();

        System.out.print("Enter the price: ");
        float price2 = myScanner.nextFloat();

        System.out.print("Enter the nutrient value: ");
        short nutrients2 = myScanner.nextShort();
        
        // Tidying up the console
        System.out.print("\n--------------------------");
        
        System.out.print("\n\nThe bread type is: " + tips2 + "\nThe expiring day is: " + expiringDay2 + "\nThe expiring month is: " + expiringMonth2 + "\nThe expiring year is: " + expiringYear2 + "\nThe bread is sliced: " + isSliced2 + "\nThe manufacturing country is: " + manufacturer2 + "\nThe weight is: " + weight2 + "\nThe price is: " + price2 + "\nThe nutrient value is: " + nutrients2);


    }
    
}