Sie sind auf Seite 1von 7

LAMI-ING, Ygie-II Khin P.

else
BSCE 1 System.out.println("INVALID");
Problem 11 Problem 12

import java.util.*;
public class Prob11_Resistance_LAMIING {

public static void main(String[] args) {


Scanner ygie = new Scanner (System.in);
System.out.print ("Desired connection=");
String con = ygie.nextLine();

System.out.print("R1");
double R1 = ygie.nextDouble();

System.out.print("R2");
double R2 = ygie.nextDouble();

System.out.print("R3");
double R3 = ygie.nextDouble();

if(con.equalsIgnoreCase("series")){
System.out.print("Rt");
double Rt = (R1+R2+R3);
System.out.println("Total
Resistance:"+Rt);
}
else {
if(con.equalsIgnoreCase("parallel")){
System.out.print("Rt");
double Rt =
(1/((1/R1)+(1/R2)+(1/R3)));
System.out.println("Total
Resistance:"+Rt);
}
Problem 13 import java.util.*;
public class Prob15_Grade_LAMIING {

public static void main(String[] args) {


Scanner ygie = new Scanner (System.in);
System.out.print("Enter grade");
double g = ygie.nextDouble();

if(g>=65&&g<=99){
if(g>=65&&g<=69)
System.out.println("Poor");
if(g>=70&&g<=79)
System.out.println("Fair");
if(g>=80&&g<=86)
System.out.println("Good");
if(g>=87&&g<=92)
System.out.println("Very
Good");
if(g>=93&&g<=99)
import java.util.*; System.out.println("Excellent");
public class Prob13_Year_LAMIING { }
else
public static void main(String[] args) { System.out.println("INVALID");
Scanner ygie = new Scanner(System.in); Problem18
System.out.print("Enter year");
int yr = ygie.nextInt();

if(yr%100==0){
System.out.println("Century Year");
{
if(yr%4==0)
System.out.println("Leap Year");
else
System.out.println("Ordinary Year");
}}
else
System.out.print("INVALID");
Problem 15

import java.util.*;
public class Prob18_ParkingFee_LAMIING {

public static void main(String[] args) {


Scanner ygie = new Scanner(System.in);
System.out.print("Parking hours");
double hrs = ygie.nextDouble();

if(hrs!=0&&hrs<=4){
double min = 35.00;
System.out.println("Parking Charge is:"+min+);
} else
else System.out.println("INVALID");
if(hrs>4 && hrs<=18){ }}
double min = 35.00; Problem 21
double addC = 15.00;
double Charge = ((hrs-4)*addC)+min;
System.out.println("Parking Charge
is:"+Charge+);
}
else
if(hrs>18){
double max = 250.00;
System.out.println("The Parking Charge
is:"+max);
}
} else
System.out.println("INVALID");
}
Problem 19

import java.util.*;
public class Prob21_ElectricCharge_LAMIING {

public static void main(String[] args) {


Scanner ygie = new Scanner (System.in);
System.out.print("Enter Electric Consumption");
double kwh = ygie.nextDouble();

if(kwh>0&&kwh<=400){
double C = kwh*30.117;
System.out.println("The amount to be
charged is:"+"P"+C);
}
else
if(kwh>400){
double c = (400*30.117)+(kwh-
import java.util.*; 400)*25.23;
public class Prob9_TelephoneAreaCode_LAMIING { System.out.println("The amount to be
charged is:"+"P"+c);
public static void main(String[] args) { }}}
Scanner ygie = new Scanner (System.in);
System.out.print("Enter tac");

int tac = ygie.nextInt();


int a = tac/100;
int b = tac%100/10;
int c = tac%10;

if ((a==1||a==9)&&(b>=5&&b<=9)&&(c!=0))
System.out.println("VALID");
Problem 22 Month End

import java.util.*;
public class MonthEnd_LAMIING {
public class Prob22_CommodityCode_LAMIING {
public static void main(String[] args) {
public static void main(String[] args) {
System.out.print("Enter month number");
Scanner ygie = new Scanner (System.in);
int mn = Keyboard.readInt();
System.out.print("Commodity Code");
char cc = Keyboard.readChar();
System.out.print("Enter year");
System.out.print("Quantity Bought");
int y = Keyboard.readInt();
int qb = ygie.nextInt();
System.out.print("Unit Price");
switch (mn){
double up = ygie.nextDouble();
case 1:
case 3:
if(cc=='A'||cc=='a'){
case 5:
double tot = (qb*up)-(qb*up*0.15);
case 7:
System.out.print("Enter Total Amount
case 8:
to be Paid:"+tot);
case 10:
}
case 12:
System.out.println("Last day of the
else{
month is 31");
if(cc=='B'||cc=='b'){
break;
double tot = (qb*up)-(qb*up*0.10);
System.out.print("Enter Total Amount to be
case 2:
Paid:"+tot);
if (y%4==0){
}
System.out.println("Last day of
else{
the month is 29");
if(cc=='C'||cc=='c'){
}
double tot = (qb*up);
else{
System.out.print("Enter Total Amount
System.out.print("Last day of the
to be Paid:"+tot);
month is 28");
}
}
else
break;
System.out.println("INVALID");
case 4:
}}}}
case 6:
case 9:
case 11:
default: System.out.print("INVALID");

pub
lic
clas
s
Gra
de_LAMIING {
System.out.println("Last day of public static void main(String[] args) {
the month is 30");
break; System.out.print("Enter grade");
default:System.out.print("INVALID"); int g = Keyboard.readInt();
Commodity Code Using Switch switch (g){
import java.util.*; case 65:
public class CommodityCodeUsingSwitch_LAMIING { case 66:
case 67:
public static void main(String[] args) { case 68:
Scanner ygie = new Scanner (System.in); case 69:
System.out.print("Enter commodity code"); System.out.println("Poor");
char cc =Keyboard.readChar(); break;
System.out.print ("Enter quantity bought");
int qb = ygie.nextInt(); case 70:
System.out.print("Enter unit price"); case 71:
double up = ygie.nextDouble(); case 72:
case 73:
switch (cc){ case 74:
case 'a': case 75:
case 'A': case 76:
double tot = (qb*up)- case 77:
(qb*up*0.15); case 78:
System.out.print("Total case 79:
amount:"+tot); System.out.println("Fair");
break; break;
case'b':
case'B': case 80:
tot = (qb*up)-(qb*up*0.10); case 81:
System.out.print("Total case 82:
amount:"+tot); case 83:
break; case 84:
case'c': case 85:
case'C': case 86:
tot = (qb*up); System.out.println("Good");
System.out.print("Total break;
amount:"+tot);
break; case 87:
case 88:
case 89:
case 90:
case 91:
case 92:
System.out.println("Very Good");
break;

case 93:
case 94:
case 95:
case 96:
case 97:
case 98:
case 99:
System.out.println("Excellent");
break;

default: System.out.print("INVALID");
}}}

}
}

Das könnte Ihnen auch gefallen