Download Downlaod File

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Intro Programming of Mis
Walaa Ali Bamardouf
200900609
Section: 201
Assignment 1
Chapter 3 page 120 :
Q4 + Q5:
import java.util.Scanner;
public class Q4 {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
double S1 = 95.3;
double S2 = 78.5;
double S3 = 85.2;
double a;
System.out.println ("
Score1
System.out.println ("
------
System.out.println ("
95.3
Score2
-----78.5
Score3");
------");
85.2");
a = (S1 + S2 + S3) / 3;
System.out.println (" Your average Scores = " + a + "% ");
}
}
Chapter 4 Page 148 :
import java.util.Scanner;
public class Q1 {
public static void main(String[] args) {
// TODO code application logic here
Scanner scan = new Scanner (System.in);
double F;
double C;
System.out.println ("Convert a temperature from Fehrenheit to Centigrade");
F=scan.nextDouble ();
C= 0.56*(F+32) ;
System.out.println ( C + "C");
}
}
Chapter 5 :
Q14 page 188 :
a. x = 0
y=0
b. x = 4
y = 16
c. x = -5
y = -125
d. x = 10
y = 100
Problems page 190 – 191 :
Q2.
import java.util.Scanner;
public class GrossPay {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
Double HR, HW;
System.out.print ("Enter your hourly rate : ");
HR = scan.nextDouble ();
System.out.println (" ");
System.out.print ("Enter your hours worked per week : ");
HW = scan.nextDouble ();
System.out.println (" ");
Double OT, GP, T;
GP = HR * HW;
OT = (40 - HW) * (HR * 1.5);
T = GP + OT;
if (HW > 40)
System.out.println ("Your weekly gross pay including overtime is : "+ T);
else
System.out.println ("Your weekly gross pay is : "+ GP);
}
}
Q4.
import java.util.Scanner;
public class Q4 {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
int x, y;
System.out.println ("Enter two numbers : ");
x=scan.nextInt ();
y=scan.nextInt ();
if (x < y)
System.out.println("Your numbers in order: " + "\n " + x + "\n " + y );
else
System.out.println("Your numbers in order: " + "\n " + y + "\n " + x );
}
}
Q7.
import java.util.Scanner;
public class CreditCard{
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
long acct;
String name;
double x;
System.out.println ("Enter an account number : " );
acct = scan.nextLong ();
System.out.println ("Enter a customer name : " );
name = scan.next();
System.out.println ("Enter a current balance : " );
x = scan.nextDouble();
System.out.println (" ");
if (x > 500)
System.out.println ("The interest of credit card in monthly is : " + "\n " + ((x * 0.12)/12) );
else
System.out.println ("The interest of credit card in monthly is : " + "\n " + ((x * 0.18)/12) );
}
}
Q7. Page 227:
10
21
32
41
52
Page 228:
Q11.
-3
-2
-1
Q12.
-2
-1
1
2
3
Q13.
-2
-1
Related documents