top of page

Java Assignment Help | Sample Paper



Background

Travel in the times of the covid-19 pandemic can be tricky. Different jurisdictions have different requirements on

  • whether or not you can fly directly to them from other jurisdictions,and

  • what kinds of tests you must have before entering.

Add the complexity of different travel opportunities by air vs by train and you start to need an advanced degree just to make travel arrangements.


Travellers can also have different priorities when making travel plans. Some want to minimize overall cost. Others want to travel with the least time in shared planes and trains. Still others want to have the fewest stops in their travels.


You will develop a Java class that will help travellers optimize their travel plans to get from one city to another.


Problem

Implement a class called TravelAssistant that will accept information that describes the travel conditions for flights and train rides. The TravelAssistant then finds the best travel plan for individuals basd on their start and destination cities, their vaccination status, and a description of what they prioritize in their travel plans


Your TravelAssistant class will include the following methods, at a minimum:

  • boolean addCity( String cityName, boolean testRequired, int timeToTest, int nightlyHotelCost ) throws IllegalArgumentException

  • boolean addFlight( String startCity, String destinationCity, int flightTime, int flightCost) ) throws IllegalArgumentException

  • boolean addTrain( String startCity, String destinationCity, int trainTime, int trainCost) ) throws IllegalArgumentException

  • List planTrip ( String startCity, String destinationCity, boolean isVaccinated, int costImportance, int travelTimeImportance, int travelHopImportance ) throws IllegalArgumentException

Each of the methods operates as follows:

addCity

Indicate that a particular city is a possible starting point or destination in the travel plans. The parameters provide information about the city:

  • cityName – the name of the city, which should be kept unique.

  • testRequired – true if someone who is unvaccinated requires a negative covid test to travel into the city. Vaccinated individuals can enter the city whether or not testRequired is true or false.

  • timeToTest – the number of days that it takes to get a covid test result in the city. Someone who isn’t starting in this city would spend this many days in a hotel while waiting for test results. If timeToTest is negative then you cannot get a covid test in the city.

  • nightlyHotelCosts – the cost of spending one night in a hotel in this city. All hotel costs will be normalized to the same currency before being reported to the TravelAssistant.

The method throws an exception if the input parameters are unacceptable. The method returns true if the city can now be used in the TravelAssistant, and returns false if the information contradicts data already known by the TravelAssistant.


addFlight

Record the existence of a one-way flight from the startCity to the destinationCity. Parameter flightTime is the in-air time of the flight (in minutes) and parameter flightCost is the cost of that flight.


The method throws an exception if the input parameters are unacceptable. The method returns true if the flight can be used by the TravelAssistant, and returns false if the information contradicts data already known by the TravelAssistant.


addTrain

Record the existence of a one-way train ride from the startCity to the destinationCity. Parameter trainTime is the on-train time of the trip (in minutes) and parameter trainCost is the cost of that train trip.


The method throws an exception if the input parameters are unacceptable. The method returns true if the train ride can be used by the TravelAssistant, and returns false if the information contradicts data already known by the TravelAssistant.


planTrip

Determine the sequence of plane, train, and city stays needed to travel from the startCity to the destinationCity. You can determine your own way to find the best path, but I recommend starting with looking at Dijkstra’s algorithm, which computes the shortest path in a graph.


The best path is defined by what the traveller feels is most important. Those importances are defined by the relative weights of each of cost (both travel cost and hotel cost), travel time, and number of hops in the travel (taking one flight or one train ride is one “hop”; staying in a city is not a hop). Those relative weights are non-negative integers:

  • costImportance

  • travelTimeImportance

  • travelHopImportance

For example, if cost is the only factor then costImportance can be 1 with travelTimeImportance and travelHopImportance both being 0. On the other hand, if the cost of a flight is equally important to each minute spent travelling then costImportance can be 1, travelTimeImportance can be 1 and travelHopImportance can be 0.


Boolean variable isVaccinated lets the TravelAssistant know whether or not the traveller is vaccinated; an unvaccinated individual may need to plan to get a covid test somewhere during the trip to enter one of the cities.


The method returns the list of cities visited on the trip along with the mode of travel. Each string in the returned list consists of the mode of travel (start, fly, train), a space, and then the city at the end of the flight or train ride (or the starting point as the first entry).


If there is no way to travel between the given cities then return null as the list.


Assumptions

You may assume that

  • All costs are in comparable currencies.

  • All travel times are in minutes.

  • When testing your code, the “best” travel plan will be unique, so you don’t need to worry about which travel plan to return in the case of a tied cost.

Constraints

  • You may use any data structures from the Java Collection Framework.

  • You may not use a library package to for your graph or for the algorithm on your graph.

  • If in doubt for testing, I will be running your program on timberlea.cs.dal.ca. Correct operation of your program shouldn’t rely on any packages that aren’t available on that system.

Notes

  • You will need to write your own “main()” driver to test your class, or use JUnit to test your class.

  • You will need a class to store each vertex of the graph and a class to store each travel “hop”.

  • You will need to choose whether to store the graph as an adjacency matrix, as an adjacency list, or as an incidence matrix. Your best bet will likely be an adjacency list.

  • You might consider writing your own method to print the graph. It might help simplify your debugging.

  • It may be that you cannot plan travel between every pair of cities.

  • When providing relative importance of cost, travel time, and hops, notice that the underlying units (dollars, minutes, and hops) may not be directly comparable. Valuing each factor equally may not look like the same integer for each of the factors. Instead, you might think of the importance as the dollar value to me of each minute of travel time and the dollar value to me of making one fewer hop. That interpretation shouldn’t change your code, but it may help you determine test case values.


You Might Get Help In:

  • Java Assignment Help

  • Java Project Help

  • Java Homework Help

  • Java Coursework Help

  • Java Coding Help

  • Java OOPs Programming Help

  • And More Other Related Help

To get instant help you can send your requirement details at realcode4you@gmail.com and get instant help with an affordable price.

88 Comments


https://33winiu.com/ mình ghé thử cho biết vì thấy có người nhắc, mở lên cái là nhận ra vibe WordPress liền. Trang nhìn khá gọn, không rối mắt, kiểu như mới dựng xong nên mọi thứ còn tối giản. Mình lướt một vòng thì thấy đúng một bài kiểu “Hello world!” với câu chào “Welcome to WordPress” y như bài mặc định lúc cài mới. Cảm giác nhẹ nhàng, không bị nhồi đủ thứ nên đọc cũng nhanh, không cần suy nghĩ nhiều. Ai từng nghịch WordPress chắc sẽ thấy quen cực, vì trong nội dung còn để nguyên câu “Edit or delete it, then start writing!” như template chưa chỉnh. Nhìn chung giao diện đơn giản và phần bài viết…

Like

https://keonhacai.plus/ tối mình mở lên xem thử cho biết thôi, vì kiểu mấy trang bóng đá hay trình bày rối mắt lắm. Lướt một vòng thì thấy họ để lịch thi đấu với tỷ lệ kèo theo từng ngày khá rõ, nhìn vào là biết hôm nay có trận nào, khỏi phải kéo lên kéo xuống nhiều, mà mấy bảng số liệu cũng chia cột gọn nên đọc nhanh được kèo chính. Mình không ngồi đọc nhận định dài dòng hay gì, chủ yếu xem giao diện có dễ dùng không. Trên điện thoại bấm qua lại mấy mục vẫn ổn, cảm giác điều hướng mượt chứ không bị lạc menu. Nói chung mình chỉ coi như một chỗ tra…

Like

TR88 mình thấy dạo này nhắc hoài nên cũng ghé thử cho biết, kiểu vào xem giao diện có dễ dùng không thôi. Lướt một vòng thấy trang tải khá nhanh, bấm qua lại mấy mục không bị đứng hình nên đỡ khó chịu. Cách họ chia nội dung theo từng khối nhìn gọn, kéo xuống vẫn theo kịp chứ không bị rối mắt. Ở phần đầu trang mình để ý họ đặt mấy dòng kiểu “website chính thức” với “uy tín 2026” khá nổi, nên vừa vào là hiểu họ muốn nói gì luôn. Mình không ngồi soi trò nào cụ thể, chỉ thấy bố cục rõ ràng, chữ to nhỏ phân cấp ổn, nhìn phát biết đâu là…

Like

https://bonoclubcasino.mx/guia-app/ Entré porque andaba con la duda típica de “¿esto es seguro o me estoy metiendo en un lío?” y la guía me cayó bien, está escrita sin vueltas. Lo que más me sirvió es que repiten algo obvio pero que mucha gente se salta: antes de instalar, checar bien que el enlace sea la fuente oficial, porque hay apps falsas que se hacen pasar por casino y luego vienen los problemas. También me gustó que no dramatizan con lo de Android cuando sale la advertencia al instalar un APK, lo explican como algo que puede pasar y ya. No me puse a hacerlo paso por paso, pero para orientarte rápido funciona. Además se siente fácil de escanear porque tiene…

Like

B2XBET foi o termo que me fez parar nesse portal, mais por curiosidade de como eles explicam a situação do que por qualquer outra coisa. Achei legal que eles já deixam bem claro que é um site editorial independente, sem aquele papo de “parceria” disfarçada. Outra coisa que me chamou atenção é que eles batem na tecla de que a marca não aparece na lista oficial mais recente que eles consultaram, então o tom fica bem pé no chão. A leitura flui porque o texto é bem picado em blocos curtos, e não vira um paredão cansativo. Também ajuda muito eles colocarem a data de atualização bem visível (28 de julho de 2026), então você entende rapidinho de quando é…

Like

REALCODE4YOU

Realcode4you is the one of the best website where you can get all computer science and mathematics related help, we are offering python project help, java project help, Machine learning project help, and other programming language help i.e., C, C++, Data Structure, PHP, ReactJs, NodeJs, React Native and also providing all databases related help.

Hire Us to get Instant help from realcode4you expert with an affordable price.

USEFUL LINKS

Discount

ADDRESS

Noida, Sector 63, India 201301

Follows Us!

  • Facebook
  • Twitter
  • Instagram
  • LinkedIn

OUR CLIENTS BELONGS TO

  • india
  • australia
  • canada
  • hong-kong
  • ireland
  • jordan
  • malaysia
  • new-zealand
  • oman
  • qatar
  • saudi-arabia
  • singapore
  • south-africa
  • uae
  • uk
  • usa

© 2026 IT Services provided by Realcode4you.com

bottom of page