OneCompiler

TO STORE THE BIKE NUMBER, PHONE NUMBER, NAME, NUMBER OF DAYS AND CALCULATE THE RENT .

136

Write a program to store the bike number , phone number , name , number of days and calculate the rent.

import java.util.*;

public class BikeRent {
int phno , nod , rent; String n , bino;
public void input()
{
Scanner sc = new Scanner(System.in);
System.out.println("ENTER YOUR BIKE NUMBER : ");
bino = sc.next();
System.out.println("ENTER YOUR PHONE NUMBER : ");
phno = sc.nextInt();
System.out.println("ENTER YOUR NAME : ");//Can be asked at the first instance (it's your wish)
n = sc.next();
System.out.println("ENTER THE NUMBER OF DAYS ");
nod = sc.nextInt();
}
public void compute()
{
if(nod == 1)
rent = 1500;
else if (nod>1&&nod<=5)
rent = nod
300;
else if (nod>5 && nod<10)
rent = nod200;
else
rent = nod
100;
}
public void display()
{
System.out.println("RENT : " +rent);
}
public static void main(String[]args)
{
BikeRent br = new BikeRent();
br.input();
br.compute();
br.display();
}
}

FOR CODE ,
CLICK : https://onecompiler.com/java/3y4ccmngy (TO FIND OUTPUT)