0% found this document useful (0 votes)
6 views3 pages

Oop Assignment

Uploaded by

Abi Ba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Oop Assignment

Uploaded by

Abi Ba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Import java.util.

*;
import java.util.Scanner;

class User implements Serializable {


static final long serialVersionUID = 421L;
public String firstName, surName, userName, address, password;
public User() {
}
public void setfirstName(String fn) {
this.firstName = fn;
}
public void setSurName(String sn) {
this.surName = sn;
}
void setUserName(String un) {
this.userName = un;
}
void setAddress(String a) {
this.address = a;
}
void setPassword(String p) {
this.password = p;
}
public String getFirstName() {
return firstName;
}
public String getSurName() {
return surName;
}
public String getUserName() {
return userName;
}
public String getAddress() {
return address;
}
public String getpassword() {
return password;
}
}

class Passenger extends User {


public Passenger() {
}
}

class Admin extends User {


public Admin () {
}
}

class Departure implements Serializable {


static final long serialVersionUID = 421L;
String departureName;
double km;
Passenger user;
public Departure() {
}
public Departure (String dn,double k) {
departureName = dn;
km = k;
}
void setKm(double k) {
km = k;
}
public double getKm() {
return km;
}
void setDepartureName(String dn) {
this.departureName = dn;
}
public String getDepartureName() {
return departureName;
}
}

class Destination implements Serializable {


static final long serialVersionUID = 421L;
String destinationName;
double km;
public Destination() {
}
public Destination(String dsn, double k){
destinationName = dsn;
km = k;
}
void setKm(double k) {
km = k;
}
public double getKm() {
return km;
}

public void setDestinationName(String dsn) {


this.destinationName = dsn;
}

public String getDestinationName() {


return destinationName;
}
}

abstract class Ticket {


String type;

abstract String getType();


}

class TicketType extends Ticket {


String type;
void setType(String t) {
this.type = t;
}
public String getType() {
return type;
}
}

class indexer implements Serializable {


int indexer;
indexer(){
}
indexer(int in) {
this.indexer = in;
}

void setIndexer(int ind){


this.indexer = ind;
}
int getIndexer() {
return indexer;
}
}

class CostCalculator implements Serializable {


static final long serialVersionUID = 421L;
double luggageCost;
double perkm;

public void setPerkm(double pkm) {


perkm = pkm;
}
public void setLuggageCost(double lc) {
luggageCost = lc;
}
public double getluggageCost() {
return luggageCost;
}
public double getPerkm() {
return perkm;
}
}

You might also like