0% found this document useful (0 votes)
29 views4 pages

Case 1

The document contains 3 code examples (cases) that check various conditions and print different outputs based on those conditions being true or false. Case 1 checks conditions for different catalog seasons and prints which catalog to send. Case 2 checks student attributes against requirements and prints to either list their details or reject them. Case 3 checks purchasing conditions and prints the applicable discount amount.

Uploaded by

Raniya Rachman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views4 pages

Case 1

The document contains 3 code examples (cases) that check various conditions and print different outputs based on those conditions being true or false. Case 1 checks conditions for different catalog seasons and prints which catalog to send. Case 2 checks student attributes against requirements and prints to either list their details or reject them. Case 3 checks purchasing conditions and prints the applicable discount amount.

Uploaded by

Raniya Rachman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CASE 1

package catalogproduct;

public class CatalogProduct {

public static void main(String[] args) {

//variable inputan

boolean catalogmusimgugur = true;

boolean catalogmusimsemi = true;

boolean catalogspecial = true;

if ((catalogmusimgugur == true) && (catalogmusimsemi == false) && (catalogspecial == false))

System.out.println("Kirim catalog musim gugur");

else if ((catalogmusimgugur == false) && (catalogmusimsemi == true) && (catalogspecial == false))

System.out.println("Kirim catalog musim semi");

else if ((catalogmusimgugur == false) && (catalogmusimsemi == false) && (catalogspecial == true))

System.out.println("Kirim kedua catalog");

else
{

System.out.println("Tidak mengirim catalog apapun");

CASE 2
package mensbasketball;

public class Mensbasketball {

public static void main(String[] args) {

//variableawal

int mincredithours = 12;

int mininchestall = 77;

int minpoundweight = 88;

//variableinputan

int credithours = 12;

int inchestall = 77;

int poundweight = 88;

boolean malestudents = true;

if ((credithours == mincredithours) && (inchestall == mininchestall) && (poundweight ==


minpoundweight) && (malestudents == true) )

System.out.println("List the student's name and address");

else

System.out.println("Reject the student");


}

CASE 3

package merchandise;

public class Merchandise {

public static void main(String[] args) {

//variable awal

int minunitpurchased = 50;

//variable inputan

int unitpurchased = 100;

boolean wholesaler = true;

boolean cash = true;

if ((unitpurchased >= minunitpurchased) && (wholesaler == true) && (cash == true))

System.out.println("Additional discount 4%, you get 6% discount");

else if ((unitpurchased >= minunitpurchased) && (wholesaler == true)&& (cash == false))

System.out.println("Additional discount 2%, you get 4% discount");


}

else if ((unitpurchased >= minunitpurchased) && (wholesaler == false) && (cash == false))

System.out.println("Get discount 2%");

else

System.out.println("No discount");

You might also like