0% found this document useful (0 votes)
7 views

Conditional STMT Tasks

Uploaded by

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

Conditional STMT Tasks

Uploaded by

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

TASK 01:

//theory mark and practical mark both are true, which means print paper 1 pass with marks if
anyone fails, it means print fail to reason with marks.

package first;
public class Task1
{
public static void main(String[] args)
{
// Declare and assign theory and practical marks
int theoryMark = 55;
int practicalMark = 35;

// Set the passing criteria for both theory and practical exams
int passingMarkTheory = 40;
int passingMarkPractical = 20;

// Check if both marks meet the passing criteria

if (theoryMark >= passingMarkTheory && practicalMark >= passingMarkPractical)


{
System.out.println("Paper1: pass with Theory Marks: " + theoryMark + " and Practical
Marks: " + practicalMark);
}

else if (theoryMark < passingMarkTheory && practicalMark < passingMarkPractical)


{
System.out.println("Fail due to both Theory and Practical with Theory Marks: " +
theoryMark + " and Practical Marks: " + practicalMark);
}

else if (theoryMark < passingMarkTheory)


{
System.out.println("Fail due to Theory Marks: " + theoryMark);
}

else {
System.out.println("Fail due to Practical Marks: " + practicalMark);
}
}
}
TASK 02:

//declare money=10/0-nothing 2 buy earn money first if u have this much of amount print what u
buy->return bal amount<- 10-100, 100-500, 500-1000, 1000-5000, 5000-10000, >10000

package first;
public class ShoppingTask
{
public static void main(String[] args)
{
// Initial balance set to zero
int money = 1240;

// Check the balance and suggest based on the amount


if (money == 0) {
System.out.println("Nothing to buy. Earn money first.");
} else if (money > 10 && money <= 100) {
System.out.println("You can buy a snack or a small accessory.");
System.out.println("Remaining balance: " + (money - 10) + " to " + (money - 100));
} else if (money > 100 && money <= 500) {
System.out.println("You can buy a small gift or a basic gadget.");
System.out.println("Remaining balance: " + (money - 100) + " to " + (money - 500));
} else if (money > 500 && money <= 1000) {
System.out.println("You can buy a pair of shoes or a new outfit.");
System.out.println("Remaining balance: " + (money - 500) + " to " + (money - 1000));
} else if (money > 1000 && money <= 5000) {
System.out.println("You can buy a smartphone or a tablet.");
System.out.println("Remaining balance: " + (money - 1000) + " to " + (money - 5000));
} else if (money > 5000 && money <= 10000) {
System.out.println("You can buy a laptop or a weekend vacation.");
System.out.println("Remaining balance: " + (money - 5000) + " to " + (money - 10000));
} else if (money > 10000) {
System.out.println("You can buy a luxury item or go on an international trip.");
System.out.println("Remaining balance: greater than " + (money - 10000));
}
}
}

You might also like