Question

In: Computer Science

JAVA JAVA JAVA Hey i need to find a java code for my homework, this is...

JAVA JAVA JAVA

Hey i need to find a java code for my homework, this is my first java homework so for you i don't think it will be hard for you. (basic stuff)

the problem:

Write a complete Java program

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:

  • Merchandise:
    • Merchandise number
    • Description (ex: urea, dust suppressant, sodium hypochlorite, ethylene glycol, propylene glycol, acid, milk, etc.)
    • Volume in stock (liter)
    • example
    • Merchandise.dat
    • 1, acid, 350000
      2, urea, 1000000
      3, milk, 2000000
  • Trucks:
  • Truck number
  • Transport capacity (liter ex: 35,000, 25,000, 15,000, 10,000)
  • Autonomy Range (distance km)
  • example:
  • trucks.dat
  • 1, 35000, 600
    2, 10000, 1000
    3, 20000, 800
    4, 35000, 600
  • Orders :
  • Order number
  • Client number
  • Commodity Number
  • Volume (liter)
  • Delivery city
  • exemple;
  • orders.dat:
  • 1, 1, 1, 35000, Miami
    2, 3, 2, 70000, :Los angeles
    3, 2, 3, 25000, New York
    4, 4, 1, 105000, Chicago
  • Clients :
  • Client number
  • City
  • Routes:
  • Trip number
  • Truck number
  • Number of different clients
  • Client number
  • Commodity number
  • Volume delivered
  • Delivery cities:
  • City number
  • Name

Stages of realization: THE QUESTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

  1. Write the implementation of the classes Merchandise, Customers, Trucks, Orders, Cities and Trips: for each of the classes, we propose to define the constructor of the class which makes it possible to load the existing data from Merchandise.dat, Customers.dat, Trucks.dat, Orders.dat, Trips.dat, Cities.dat files and at least one method for displaying the characteristics of a particular object from each of these classes.
  2. Write a main program (main method) which:
  • Allows you to add, delete, modify information, update data on disks (.dat files) on Goods, Customers, Trucks, Orders, Cities and Routes.
  • Allows you to display all the characteristics of the journeys made.

Also displays information about Merchandises, orders, customers, trucks, cities.

  • To do this you can use a menu in your main () function which allows you to select the operations (eg: additions, deletions, modifications, displays).

Your application must take into account the handling of errors (exceptions).

Solutions

Expert Solution

Hi,

Here's my code 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...");

}

}

Thank you :)


Related Solutions

Java homework problem: I need the code to be able to have a message if I...
Java homework problem: I need the code to be able to have a message if I type in a letter instead of a number. For example, " Please input only numbers". Then, I should be able to go back and type a number. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class LoginGui {    static JFrame frame = new JFrame("JFrame Example");    public static void main(String s[]) {        JPanel panel...
I need code written in java for one of my projects the instructions are Write a...
I need code written in java for one of my projects the instructions are Write a program that interacts with the user via the console and lets them choose options from a food menu by using the associated item number. It is expected that your program builds an <orderString> representing the food order to be displayed at the end. (See Sample Run Below). Please note: Each student is required to develop their own custom menus, with unique food categories, items...
Here is my java code. It works and has the correct output, but I need to...
Here is my java code. It works and has the correct output, but I need to add a file and I am not sure how. I cannot use the FileNotFoundException. Please help! import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Exercise { public static void main(String[] args) { Scanner input=new Scanner(System.in); int[] WordsCharsLetters = {0,0,0}; while(input.hasNext()) { String sentence=input.nextLine(); if(sentence!=null&&sentence.length()>0){ WordsCharsLetters[0] += calculateAndPrintChars(sentence)[0]; WordsCharsLetters[1] += calculateAndPrintChars(sentence)[1]; WordsCharsLetters[2] += calculateAndPrintChars(sentence)[2]; } else break; } input.close(); System.out.println("Words: " + WordsCharsLetters[0]); System.out.println("Characters: "...
Programming Java Homework: Find the Highest Score (Just need the code and directions followed exactly and...
Programming Java Homework: Find the Highest Score (Just need the code and directions followed exactly and written in Java code) Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the name and score of the student with the highest score. Use the next () method in the Scanner class to read a name, rather than using the nextLine () method.
I need a full java code. And I need it in GUI With the mathematics you...
I need a full java code. And I need it in GUI With the mathematics you have studied so far in your education you have worked with polynomials. Polynomials are used to describe curves of various types; people use them in the real world to graph curves. For example, roller coaster designers may use polynomials to describe the curves in their rides. Polynomials appear in many areas of mathematics and science. Write a program which finds an approximate solution to...
in java: In my code at have my last two methods that I cannot exactly figure...
in java: In my code at have my last two methods that I cannot exactly figure out how to execute. I have too convert a Roman number to its decimal form for the case 3 switch. The two methods I cannot figure out are the public static int valueOf(int numeral) and public static int convertRomanNumber(int total, int length, String numeral). This is what my code looks like so far: public static void main(String[] args) { // TODO Auto-generated method stub...
""""" I need new post to accepted my homework """"" Assignment Questions: There are four macro...
""""" I need new post to accepted my homework """"" Assignment Questions: There are four macro strategies to create and deliver value to customers and that can help a firm to develop a sustainable competitive advantage. Think of companies from the local market who you are very loyal to in many categories like (food, electronics, personal care etc.). Is it the product, location, operational, or customer excellence that you are loyal to that firm? Critically examine. (2.5 Marks) You have...
I have the following code for my java class assignment but i am having an issue...
I have the following code for my java class assignment but i am having an issue with this error i keep getting. On the following lines: return new Circle(color, radius); return new Rectangle(color, length, width); I am getting the following error for each line: "non-static variable this cannot be referenced from a static context" Here is the code I have: /* * ShapeDemo - simple inheritance hierarchy and dynamic binding. * * The Shape class must be compiled before the...
In Java please. I put down my code and what I was able to achieve so...
In Java please. I put down my code and what I was able to achieve so far: public class Animal {   private String gender; //stores the gender of the animal    private String type; //stores the type of the animal(bear of fish)    private int strength; //stores the strength of the animal    public Animal() {        gender = "none";        type = "none";        strength = 0;    }        public Animal (String g, String...
Please finish this code and make it work. This is my homework and my professor wont...
Please finish this code and make it work. This is my homework and my professor wont allow me to change the code in main, it's a set of huge numbers need to sort by radixsort with bit operation. #include <iostream> using namespace std; void radixLSD_help(int *items, int length, int bit) {    // – Count number of items for each bucket.    // – Figure out where each bucket should be stored (positions // of the first and last element...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT