0% found this document useful (0 votes)
9 views7 pages

New Microsoft Word Document

Uploaded by

danielfather555
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)
9 views7 pages

New Microsoft Word Document

Uploaded by

danielfather555
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/ 7

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-
default.txt to change this license

*/

package com.mycompany.lab08;

import java.util.Scanner;

/**

* @author liaoh

*/

public class Lab08 {

public static void main(String[] args) {

/////

//Q1

/////

Scanner keyboard = new Scanner(System.in);

int a = 1;

int b = 2;

int c = 3;

//1

System.out.println("Q1");

if (6 < 2 * 5) {

System.out.print("Hello");
}

System.out.print("There\n\n");

//2

System.out.println("Q2");

if (a > b) {

if (a > c) {

System.out.println("1111");

} else {

System.out.println("2222");

//3

System.out.println("Q3");

if (a < c) {

System.out.println("*");

} else if (a == b) {

System.out.println("&");

} else {

System.out.println("$\n\n");

//4

System.out.println("Q4");

if (a > b) {

System.out.println("####");

} else {

System.out.println("&&&&");
}

System.out.println("****\n\n");

//5

System.out.println("Q5");

if (a > b) {

System.out.println("####");

} else {

System.out.println("&&&&");

System.out.println("****\n\n");

//6

System.out.println("Q6");

int x = 100;

int y = 200;

if (x > 100 && y <= 200) {

System.out.print(x + " " + y + " " + (x + y));

} else {

System.out.print(x + " " + y + " " + (2 * x - y) + "\n\n");

//7

System.out.println("Q7");

if (a < c) {

System.out.println("*");

} else if (a == c) {

System.out.println("&");

} else {

System.out.println("$\n\n");
}

//8

System.out.println("Q8");

if (++a > b++ || a-- > 0) {

c++;

} else {

c--;

System.out.println(a + " " + b + " " + c);

//9

System.out.println("Q9");

if (a < b) {

System.out.println("####");

System.out.println("****");

} else {

System.out.println("&&&&\n\n");

//10

System.out.println("Q10");

if ('a' > 'b' || 66 > (int) ('A')) {

System.out.println("#*#\n\n");

/////

//Q3

/////

int t;
System.out.println("please enter the Temperature");

t = keyboard.nextInt();

if (t < 0) {

System.out.println("Freezing Weather");

} else if (t <= 10) {

System.out.println("Very Cold");

} else if (t <= 20) {

System.out.println("Cold");

} else if (t <= 30) {

System.out.println("Warm");

} else if (t <= 40) {

System.out.println("Hot");

} else if (t > 40) {

System.out.println("Very Hot");

/////

//Q4

/////

int n1, n2, n3;

System.out.println("plesae enter your first interger:");

n1 = keyboard.nextInt();

System.out.println("plesae enter your second interger:");

n2 = keyboard.nextInt();

System.out.println("plesae enter your last interger:");

n3 = keyboard.nextInt();

if (n1 == n2 && n1 == n3) {


System.out.println("Equilateral");

} else if (n1 == n2 && n1 != n3) {

System.out.println("Isosceles");

} else if (n1 != n2 && n1 != n3 && n2 != n3 && n1 + n2 >= n3 && n1


+ n3 >= n2 && n2 + n3 >= n1) {

System.out.println("Scalene");

} else if (n1 + n2 <= n3 || n1 + n3 <= n2 || n2 + n3 <= n1) {

System.out.println("Not a Triangle");

/////

//Q5

/////

int amount;

System.out.println("please enter the amount:");

amount = keyboard.nextInt();

if (amount > 100) {

System.out.println("The delivery fee is Free ");

} else if (amount <= 99.99 && amount >= 50) {

System.out.println("The delivery fee is 5$ ");

} else if (amount <= 49.99 && amount >= 25) {

System.out.println("The delivery fee is 10$ ");

} else if (amount < 25) {

System.out.println("The delivery fee is 15$");

}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy