initial
This commit is contained in:
3
META-INF/MANIFEST.MF
Normal file
3
META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: TripToAfrica
|
||||||
|
Class-Path: .
|
||||||
23
README.md
Normal file
23
README.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
### define 2 modules that setup in vscode with natural default configuration
|
||||||
|
from modules
|
||||||
|
### Run and Debug Java
|
||||||
|
|
||||||
|
cd to: out
|
||||||
|
|
||||||
|
: java [mainClass] [jar]
|
||||||
|
|
||||||
|
java TripToAfrica ./triporganizer.jar
|
||||||
|
|
||||||
|
|
||||||
|
### create jar archive:
|
||||||
|
|
||||||
|
cd to: out
|
||||||
|
|
||||||
|
jar --create --verbose --file triporganizer.jar --manifest ..\META-INF\MANIFEST.MF *
|
||||||
|
|
||||||
|
|
||||||
|
### compile - build:
|
||||||
|
|
||||||
|
1. cd: src/edu.trip
|
||||||
|
|
||||||
|
2. javac -g -d ../../out *
|
||||||
29
src/edu/africa/TripToAfrica.java
Normal file
29
src/edu/africa/TripToAfrica.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package edu.africa;
|
||||||
|
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
||||||
|
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||||
|
import edu.trip.AirplaneReservation;
|
||||||
|
import edu.trip.HotelReservation;
|
||||||
|
import edu.trip.Person;
|
||||||
|
import edu.trip.RentalCarReservation;
|
||||||
|
import edu.trip.Trip;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
public class TripToAfrica {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
|
||||||
|
Future<Float> future = executor.submit(() -> {
|
||||||
|
Trip trip = new Trip();
|
||||||
|
trip.theme = "Going To Africa";
|
||||||
|
trip.organizer= new Person();
|
||||||
|
trip.addReservation(new HotelReservation());
|
||||||
|
trip.addReservation(new AirplaneReservation());
|
||||||
|
trip.addReservation(new RentalCarReservation());
|
||||||
|
|
||||||
|
return trip.calculatePrice();
|
||||||
|
|
||||||
|
});
|
||||||
|
System.out.println("done: " + future.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
src/edu/trip/Address.java
Normal file
23
src/edu/trip/Address.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package edu.trip;
|
||||||
|
|
||||||
|
public class Address {
|
||||||
|
|
||||||
|
public String street;
|
||||||
|
|
||||||
|
public String city;
|
||||||
|
|
||||||
|
public String state;
|
||||||
|
|
||||||
|
public String zip;
|
||||||
|
|
||||||
|
//format and return object's data in XML format
|
||||||
|
public String toString() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//create and return a copy of the object
|
||||||
|
public Address clone() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
39
src/edu/trip/AirplaneReservation.java
Normal file
39
src/edu/trip/AirplaneReservation.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package edu.trip;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class AirplaneReservation extends Reservation {
|
||||||
|
|
||||||
|
public String sourceAirport;
|
||||||
|
|
||||||
|
public String destinationAirport;
|
||||||
|
|
||||||
|
public Date flightDate;
|
||||||
|
|
||||||
|
public String airline; // 3 letter airport designation
|
||||||
|
|
||||||
|
//format and return object's data in XML format
|
||||||
|
public String toString() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//update reservation data using passed in parameters
|
||||||
|
public void updateAirplaneReservation(String aline, String sAirport, String dAirport, Date fDate) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculate and return the distance between source and destination airport
|
||||||
|
public int airportDistance() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate and return the reservation's price
|
||||||
|
public float calculatePrice() {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
//create and return a copy of the object
|
||||||
|
public AirplaneReservation clone() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
34
src/edu/trip/HotelReservation.java
Normal file
34
src/edu/trip/HotelReservation.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package edu.trip;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class HotelReservation extends Reservation {
|
||||||
|
|
||||||
|
public Address address;
|
||||||
|
|
||||||
|
public String roomType; // single or double
|
||||||
|
|
||||||
|
public Date checkIn;
|
||||||
|
|
||||||
|
public Date checkOut;
|
||||||
|
|
||||||
|
//format and return object's data in XML format
|
||||||
|
public String toString() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate and return the reservation's price
|
||||||
|
public float calculatePrice() {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
//update reservation data using passed in parameters
|
||||||
|
public void updateHotelReservation(String roomType, Date checkIn, Date checkOut, Address address) {
|
||||||
|
}
|
||||||
|
|
||||||
|
//create and return a copy of the object
|
||||||
|
public HotelReservation clone() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
17
src/edu/trip/Person.java
Normal file
17
src/edu/trip/Person.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package edu.trip;
|
||||||
|
|
||||||
|
public class Person {
|
||||||
|
|
||||||
|
public String name; // save the name value
|
||||||
|
|
||||||
|
// format and return object's data in XML format
|
||||||
|
public String toString() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create and return a copy of the object
|
||||||
|
public Person clone() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
40
src/edu/trip/RentalCarReservation.java
Normal file
40
src/edu/trip/RentalCarReservation.java
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package edu.trip;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class RentalCarReservation extends Reservation {
|
||||||
|
|
||||||
|
public String make;
|
||||||
|
|
||||||
|
public String model;
|
||||||
|
|
||||||
|
public Date scheduledPickUp;
|
||||||
|
|
||||||
|
public Date scheduledDropOff;
|
||||||
|
|
||||||
|
public Date actualPickUp;
|
||||||
|
|
||||||
|
public Date actualDropOff;
|
||||||
|
|
||||||
|
public float window; // window of how far on either side the car can be picked up and dropped off
|
||||||
|
|
||||||
|
// update reservation data using passed in parameters
|
||||||
|
public void updateRentalCarReservation(String make, String model, Date scheduledPickUp, Date scheduledDropOff, Date actualPickUp, Date actualDropOff, float window) {
|
||||||
|
}
|
||||||
|
|
||||||
|
//format and return object's data in XML format
|
||||||
|
public String toString() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate and return the reservation's price
|
||||||
|
public float calculatePrice() {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
//create and return a copy of the object
|
||||||
|
public RentalCarReservation clone() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
src/edu/trip/Reservation.java
Normal file
23
src/edu/trip/Reservation.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package edu.trip;
|
||||||
|
|
||||||
|
public class Reservation {
|
||||||
|
|
||||||
|
public String confirmationNumber; // unique confirmation number for the reservation (generated by UI)
|
||||||
|
public String contractPhoneNumber; // contact number for the reservation
|
||||||
|
|
||||||
|
// calculate and return the reservation's price
|
||||||
|
public float calculatePrice() {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
//format and return object's data in XML format
|
||||||
|
public String toString() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//create and return a copy of the object
|
||||||
|
public Reservation clone() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
34
src/edu/trip/Trip.java
Normal file
34
src/edu/trip/Trip.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package edu.trip;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Trip {
|
||||||
|
|
||||||
|
public List<Reservation> reservations; // save and manage multiple trip.Reservation objects
|
||||||
|
public Person organizer; // person responsible for the trip
|
||||||
|
public String theme; // theme of the trip
|
||||||
|
|
||||||
|
// add reservation object to the list of trip.Reservation objects (check for duplicates)
|
||||||
|
// and return the number of reservation
|
||||||
|
public int addReservation(Reservation reservation) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find matching reservation in Vector list and update it with parameter's value
|
||||||
|
public void updateReservation(Reservation reservation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// find trip.Reservation in Vector that matches conf number and delete from Vector
|
||||||
|
public void deleteReservation(String confirmationNumber) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// save trip.Trip information to the passed in file
|
||||||
|
public void saveToFile(String fileName) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculate and return the trip.Trip's price
|
||||||
|
public float calculatePrice() {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
35
src/edu/trip/TripOrganizer.java
Normal file
35
src/edu/trip/TripOrganizer.java
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package edu.trip;
|
||||||
|
|
||||||
|
public class TripOrganizer {
|
||||||
|
|
||||||
|
public Trip trip; // store and manage a single trip.Trip object at a time
|
||||||
|
|
||||||
|
// Add reservation to the currently loaded trip.Trip
|
||||||
|
public void addReservation(Reservation reservation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// save current trip.Trip data to a file
|
||||||
|
public void saveToFile(String filename) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// load a trip.Trip object from a file
|
||||||
|
public void openFromFile(String filename) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the currently loaded trip.Trip's reservation (one that matches the parameter)
|
||||||
|
public void editReservation(Reservation reservation) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete reservation matching conf number from currently loaded trip
|
||||||
|
public void deleteReservation(String confirmationNumber) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete the currently loaded trip.Trip and its file (value smust match)
|
||||||
|
public void deleteTrip(String fileName) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// load new trip.Trip from the passed in object (close the currently loaded trip.Trip)
|
||||||
|
public void createNewTrip(Trip trip) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
10
src/edu/trip/package-info.java
Normal file
10
src/edu/trip/package-info.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* This package contains utility classes for Trip Reservation operations.
|
||||||
|
* <p>
|
||||||
|
* It includes classes for TripOrganize and Trip processing of Reservations.
|
||||||
|
* </p>
|
||||||
|
* @since 1.0
|
||||||
|
* @author theAuthor
|
||||||
|
* @version 1.1
|
||||||
|
*/
|
||||||
|
package edu.trip;
|
||||||
4
src/module-info.java
Normal file
4
src/module-info.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module edu.trip {
|
||||||
|
exports edu.trip;
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user