In: Computer Science
Write a complete Java program pleaaase
The transport Company in which you are the engineer responsible of operations for the optimization of the autonomous transport of liquid bulk goods, got a design contract for an automated intelligent transport management system that are autonomous trucks which transport liquid bulk goods (urea, dust suppressants, acids, gasoline, milk, etc.), forming part of customer orders.
After loading at a centralized distribution center, the trucks move autonomously to the delivery points. After loading at a centralized distribution center, the trucks move autonomously to the delivery points.
The management of this automated intelligent transport management system is based on the following entities:
1) Goods stored at the centralized distribution center (Trois-Rivières).
2) Autonomous trailer trucks (tanks)
3) Orders of goods transported by autonomous trucks
4) Customers
5) Freight transport routes
6) Destination cities (delivery cities)
From lists of goods ordered from customers, a clerk generates delivery routes that send autonomous trucks pre-loaded with liquid goods transported by tanker.
The characteristics of each entity are:
Stages of realization:
Also displays information about Merchandises, orders, customers, trucks, cities.
Your application must take into account the handling of errors (exceptions).
Here's my coode for the same,
import java.util.*
//Defining a class of all functionalities.
Public class transport{
String Goods;
String Customers;
String Trucks;
String Orders;
String Cities;
String Routes;
Transport(String filename){//file-read operation
Scanner reader = new Scanner(new FileInputStream(filename);
while (reader.hasNext()) { //getting data
Goods = reader.next();
Customers = reader.next();
Trucks = reader.next();
Orders = reader.next();
Cities = reader.next();
Routes = reader.next();
}
}
//Getters and setters
Public getGoods{
return Goods;
}
Public deleteGoods{
Goods = null;
}
Public setGoods(String a){
Goods = a;
}
Public getCustomers{
return Customers;
}
Public deleteCustomers{
Customers = null;
}
Public setCustomers(String b){
Customers = b;
}
Public getTrucks{
return Trucks;
}
Public deleteTrucks{
Trucks = null;
}
Public setTrucks(String c){
Trucks = c;
}
Public getOrders{
return orders;
}
Public deleteOrders{
Orders = null;
}
Public setOrders(String d){
Orders = d;
}
Public deleteOrders{
Orders = null;
}
Public getCities{
return Cities;
}
Public deleteCities{
Cities = null;
}
Public setCities(String e){
Cities = e;
}
Public getRoutes{
return Routes;
}
Public deleteRoutes{
Routes = null;
}
Public setRoutes(String f){
Routes = f;
}
public static void main(String[] args){//driver method
Transport(file.txt)
getRoutes;
setRoutes(abc);
}
writeoperation{//save operation
try{
FileWriter fw=new FileWriter(filename);
fw.write(Goods + "," + Customers + "," + Trucks + "," + orders + "," + cities + "," + routes);
fw.close();
}
catch(Exception e){
System.out.println(e);
}
System.out.println("Success...");
}
}