Vous êtes sur la page 1sur 2

import java.util.

Scanner;
class customer
{
int bike_no; // Data Member 1
String name;
String loc; // Data Member 2
Scanner KB=new Scanner(System.in);
void getDetails()
{
System.out.println("Enter your name :");
name=KB.nextLine();
System.out.println("Enter your Location");
loc=KB.nextLine();

System.out.println("Enter your bike number");


bike_no=KB.nextInt();

void showDetails()
{
System.out.println("Customer Name is "+name+" and has bike whose number
is "+bike_no+" location is"+loc);
}
}

class parkdata extends customer


{
int i;
int j;
int input;

void showDetails()
{
System.out.println("for how many hours you want to stay");
input=KB.nextInt();
if(input<10)
System.out.println("Charges are 10 Rs");
else
System.out.println("Charges are 20 Rs");

void showparking()
{
System.out.println("how many customers have parked");
i=KB.nextInt();

if(i<20)
{
j=i+1;
System.out.println("Your Parking spot is"+j);
}
else
System.out.println("parking is full");
}
}
class park
{
public static void main(String args[])
{
customer c=new customer();
c.getDetails();
c.showDetails();
parkdata p=new parkdata();
p.showDetails();
p.showparking();
}
}

Vous aimerez peut-être aussi