10/12/2014

BCS2233 OOP Quiz 1

1. Write a java program to input three integers and print the largest.

2.A bicycle shop in a city hires bicycles by the day at different rates for different model below:

Model No. Hire rate per Day (RM)
Model No. 1            14.00
Model No. 2            12.00
Model No. 3            10.00


In order to attract customers, the shopkeeper gives a discount on the number of days a bicycle is hired for. The policy of discount is as given below:

No. of days Discount rate (%)
1-5                            0.00
6-10                8
11 and over 15

For every bicycle hired, a deposit of RM 30.00 must be paid.
Write an algorithm (flowchart or pseudocode).

--------------------------------------------------------------
Solution (flowchart) for Question 1.























Solution (Flowchart) for question 2.



2 comments:

Muzammil said...

/**
* @(#)Rquiz1.java
*
* Rquiz1 application
*
* @author
* @version 1.00 2014/10/15
*/
import java.util.Scanner;
public class Rquiz1 {

public static void main(String[] args) {
int model,day;
double rate,disc,hc,disc_amt,total;

Scanner input=new Scanner(System.in);
// TODO, add your application code
System.out.println("enter the model and day");
model=input.nextInt();
day=input.nextInt();
if(model==1){
rate=14.0;
}
else if(model==2){
rate=12.0;
}
else{
rate=10.0;
}
if (day<6){
disc=0.0;
}
else if(day<11){
disc=0.08;
}
else{
disc=0.15;
}
hc=day*rate;
disc_amt=hc*disc;
total=hc-disc_amt+30.00 ;

System.out.println("hire cost is"+" "+hc);
System.out.println("discount ammount is"+" "+disc_amt);
System.out.println("the total is"+" "+total);

}
}

Mohd Nazri Ibrahim said...

Terima Kasih Voke

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...