Jump to content

[REQUEST] This is a project for my Examps in the Univercity. CHECK IT!


Recommended Posts

Posted

This is an excerpt from a book and maybe is the answer can you help ? :)

 

Task 1 - the Time class                               15 marks

The Time class provided already has two methods  getElapsedTime and getTotalMinutes. There will be no need to make changes to getElapsedTime, but you will need to amend getTotalMinutes.

 

1.1 Amend Time class so that it has two private fields of type int to represent the elements of time: hour and minute.

 

1.2 Provide a constructor which has no parameters and initialises the time to midnight (0hr 0 min).

 

1.3 Write a private mutator setHour which sets the value of the hour field from a suitable parameter. If the value of the parameter is within an appropriate range (between 0 - 23), the mutator should set the value of the hour field to the parameter value.  If the parameter value is outside the appropriate range, the mutator sets the field value to 0.

 

1.4 Write a private mutator  setMinute whose behaviour is similar to setHour but which uses the range appropriate for minutes (between 0 - 59). It sets the minutes field either to the value of the parameter if it is in range, or to 0 if it is outside the range.

 

1.5 Write a public mutator setTime, which sets the time from suitable formal parameters. The values of the parameters should be in the appropriate range: 0-59 for the minutes and 0-23 for the hour. If the value of a parameter is not in the required range, the value of the corresponding field should be set to 0 by the method. To avoid duplicating code, you should consider using appropriate local method calls.

 

1.6 Provide a second constructor which sets the time from suitable formal parameters. The values of the parameters must be in the appropriate range: 0-59 for the minutes and 0-23 for the hour. If the value of a parameter is not in the required range, the value of the corresponding field should be set to 0 by the constructor. To avoid duplicating code, you should consider using appropriate local method calls.

 

1.7 Write an accessor  getAsString  which returns a String representation of the time using two digits each for hour and minute separated by a colon (: ) e.g.  14:35, 07:34, 02:03 and 00:00 for midnight.

(Hint: look at the Date class).

 

1.8 Amend the code in accessor getTotalMinutes to convert a time into a total number of minutes and returns this as an int. For example, if the current time object stores 3:15, then getTotalMinutes returns the value 195. This is a private method to be called locally in getElapsedTime

 

Task 2 - the Vehicle class                               20 marks

2.1 The Vehicle class must store the following information: the reference number as an int, the vehicle’s plate as a String, the responsible technician’s (person’s) name as a String, the manufacture date of the vehicle as a Date. In addition, the class also stores the arrival time and the time they started the service session, both of type Time.

 

2.2 Write a constructor which sets the reference number, plate, technician’s name and manufacture date from suitable formal parameters. The date of manufacture should be represented by three formal parameters of type int which are then passed on as actual parameters to a Date constructor. The time when the vehicle arrived and the time when they start servicing should be set to null.

2.3 Write accessors :

• getVehicleNo which returns the vehicle’s reference number

• getRPName which returns the name of the technician as a String

• getManufactureDate which returns the vehicle manufacture date as a Date

 

2.4 Write mutators setArrivalTime and setServiceStart to set the time the vehicle arrived and the time the service session started from suitable formal parameters of type int. These formal parameters should be used to create fields of type Time with suitable values. (Remember, arrival time and service start are both of type Time, which already has constructors/methods to handle time)

 

2.5 Provide a method getAsString which returns a String representation of all the information stored about a vehicle. The String should contain the vehicle’s plate, reference no, technician’s name, date of manufacture and any other text which you think will improve the presentation. 

 

To avoid runtime errors, arrival time and the service start time should only be added to the return String, if the fields which store them are NOT null.

 

2.6 Provide an accessor getWaitingTime which returns an integer representing the number of minutes that have elapsed between the vehicle arriving and the start of the service session. Again, this should only happen if the fields which store them are not null. If either field is null, the method should return -1.

 

 

Task 3 - Testing the Time class                               14 marks

3.1 Write a tester class TimeTest, with a method doTest, to test that your Time class behaves according to the above specification. You will need to make sure that:

• Time objects are initialised from the constructor's formal parameters according to the specification given above

• Time objects can have their values set from the formal parameters of mutators, according to the specification given above

• getAsString  returns a suitable String representation of a time

• getElapsedTime returns the correct results

Choose your data carefully to ensure that you have checked the different situations which can occur.

Provide output statements so that, when doTest is invoked, output is printed in the Terminal window to show the results of your tests, and include comments in the method saying what is being tested.

 

Note: you can only use this class to test the public methods in Time. However, if these methods do not work properly, the problem may be with private methods which they call.

 

 

Task 4 - Write the DayLog class                               16 marks

4.1 The DayLog class stores information about vehicles serviced on a particular date. It has the following fields:

• logDate - should be of type Date. You should use the class provided.

• noOfArrivals - stores the number of vehicles that arrived at the service point on that day 

    and is initialised to 0.

• waitingList - an Vector used to hold the collection of Vehicles waiting for

service.

• serviceList  - an Vector used to hold the collection of Vehicles who have

started the service session.

4.2 Provide a constructor which initialises the date from suitable formal parameters and the number of arrivals to zero. It should also create the two collection fields.

 

4.3 Provide the mutator addVehicle, which has a formal parameter of type Vehicle and two ints to

represent the hour and minute when the vehicle arrived. The method sets the vehicle’s arrival time from formal parameters, increments the number of arrivals and adds the vehicle to the end of the collection of vehicles waiting to be serviced.

 

4.4 Provide the following accessors:

• getArrived - returns the number of vehicles that arrived at the service point that day

• getNumberWaiting - returns the number of vehicles in the waiting list

• findWaitingPosition - has a formal parameter of type Vehicle and returns either the 

        position of  the vehicle on the waiting list or  -1

        if the vehicle is not on the waiting list.

 

 

4.5 Provide the method serviceVehicle. The parameters of this method will be a Vehicle and two ints which represent the hour and minute when the vehicle started the service session. The method should set the vehicle’s service start time, find the position of the vehicle in the collection of vehicles on the waiting list, and use this position to remove that vehicle from the waiting list, then add the vehicle to the collection of those being serviced. Only vehicles that are in the waiting list should be served. If a vehicle is not in the waiting list, it cannot be transferred from the waiting list to the service list.

 

Task 5 - Testing the DayLog class                               10 marks

Write a tester class DayLogTest with a doTest method. Your code should create a Daylog object and some Vehicle objects, then call methods on the DayLog object in a way which shows that these methods work according to specification. At this stage, you have not been asked to provide methods which display the details of vehicles on the waiting and the service lists, but you should ensure that the numbers of vehicles on those lists are consistent with the results expected from your method calls.

 

Provide output statements so that, when doTest is invoked, output is printed in the Terminal window to show the results of your test. Include comments in the method saying what is being tested.

 

Task 6 - Extensions to DayLog class                               10 marks

This task will provide a challenge for students who are confident in their abilities. It is possible to get a very good mark for the coursework without attempting this task.

 

6.1 Provide a method printReport which prints to the terminal window the date, the number of vehicles that have arrived at the service point on that day, the number of vehicles still waiting to start their service session, and the number of vehicles that have started the service session.

 

6.2 Add the following methods to the DayLog class:

• printWaitingList prints to the terminal window the date, and a list of vehicles that are

awaiting for service

• printServiceList prints to the terminal window the date,  and a list of vehicles

    for which the service session has been initiated

• getAverageWaitingTime returns a double representing the average(mean) waiting time

(in minutes)  for vehicles for which service has started. You will need to iterate through the 

          serviceList to get the waiting times for each vehicle.

 

Include the average waiting time in the report described in 6.1.

6.3 Ensure that these new methods are tested in DayLogTest.

 

Task 7 - Demonstration                               10 marks

 

In a scheduled practical, you will be asked to demonstrate that you have a good working knowledge of the code that you have submitted. The main purpose of the demonstration is to authenticate your code by showing that you know it well enough to make changes.

 

 

 

 

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • 🔥 Grand Opening: 29 May 2026 – 19:00 Germany Time Website: https://l2-lorena.com/ Discord: https://discord.gg/TYZ88Tgx4b ━━━━━━━━━━━━━━━━━━━━━━ General Information • Chronicle: Interlude • Server Type: PvP Rates • EXP/SP: x5000 • Adena: x500 • Drop: x500 Premium Account • 2x EXP / Drop / Adena ━━━━━━━━━━━━━━━━━━━━━━ Starting Setup • Starting Town: Aden • Starting Level: 76 • Starting Gear: S-Grade ━━━━━━━━━━━━━━━━━━━━━━ Enchant System • Safe Enchant: +4 • Normal Scroll: 50% • Blessed Scroll: 70% • Crystal Scroll: 100% ━━━━━━━━━━━━━━━━━━━━━━ Subclass System • All classes available • Dominator subclass enabled • Dominator subclass cost: 20 Donate Coins ━━━━━━━━━━━━━━━━━━━━━━ Items Balance • Custom items • Elegia Armor added as Custom Set • Rare S-Grade items with boosted stats • Balanced PvP gameplay ━━━━━━━━━━━━━━━━━━━━━━ Siege & PvP Rewards • Aden Castle special reward: 200 Donate Coins • Competitive PvP and siege-focused gameplay ━━━━━━━━━━━━━━━━━━━━━━ Epic Bosses • All Epic Bosses available up to Valakas ━━━━━━━━━━━━━━━━━━━━━━ Augmentation Rates • Top LS: 100% skill chance • High LS: 7% skill chance • Mid LS: 3% skill chance ━━━━━━━━━━━━━━━━━━━━━━ Perfect For Players Who Want ✔ Fast progression ✔ Clean Interlude gameplay without custom chaos ✔ Active PvP action ✔ Competitive sieges ✔ Long-term fun
    • I think u need https://adrenalinebot.com/en/script/anti-captcha/ But contact tech support to be sure it works on ur server
    • Hello everyone, Are you looking for a server where you can have fun with friends and relive the good old days of Lineage II? Join us for an enjoyable adventure, exciting battles, and a nostalgic old-school experience together with the community. Introducing a Gold-style fast progression gameplay experience — no more spending months in the same zone farming endlessly. Enjoy faster progress, more action, and a more rewarding adventure from the very beginning. For more information and updates, visit our Facebook page and join the community! Download patch:https://mega.nz/file/hEUAFIAY#8F5BMBRV_v-O1gjDTLsCkmFiWFMvT3hzVYSMdswm2rs
    • ⚡ PRIVATE L2 SOURCE CODE & CONTRACT BUILDS Essence / Classic / High Five / Main GOD Private enterprise-level Lineage 2 development for serious projects ENGLISH For many years our studio was known mostly for public Lineage 2 builds and public development services. However, for many years now our main focus has been private development for serious projects and investors. Over time we moved away from mass-market development and focused on quality, stability, deep detailing and long-term project support. This approach allowed us to create products of a completely different level designed for large live-projects and long-term operation. Today, in addition to our old public builds, we also offer private enterprise-level solutions developed by a full professional team with many years of Lineage 2 experience. We work only with serious teams, investors and projects that understand the value of quality private development. ◆ L2 Essence — Private Builds & Source Code Latest protocols: 557–559+ Available only on a long-term contract basis. Includes: • 100% official content implementation • Custom interface systems • Active protocol updates while the contract is active • Full access to the project source code • Full technical support for the project • Bug fixing and feature development • Help with launch and long-term server development • A full professional development team working on your project • Java developers, datapack developers and project management • Many years of experience with large live projects • Long-term private cooperation and support Contract terms: Start: 10,000 USD Monthly contract: 3,000 USD / month Older Essence source code available for direct purchase: • Protocols 507–520 — 10,000 USD • Protocols 474–502 — 7,000 USD • Protocols 447–464 Seven Signs — 5,000 USD • Protocol 388 Crusade — 2,500 USD Full details: https://mmore.dev/en/essense2.html ◆ L2 Classic — Private Builds & Source Code Latest protocols: 557–559+ Available only on a long-term contract basis. Includes: • 100% official content implementation • Custom interface systems • Active protocol updates while the contract is active • Full access to the project source code • Full technical support for the project • Bug fixing and feature development • Help with launch and long-term server development • A full professional development team working on your project • Java developers, datapack developers and project management • Many years of experience with large live projects • Long-term private cooperation and support Contract terms: Start: 10,000 USD Monthly contract: 3,000 USD / month Classic source code available for direct purchase: • Classic 542 protocol — 15,000 USD • Classic 520 protocol — 12,000 USD • Classic 507 protocol — 10,000 USD • Classic 286 protocol — 8,000 USD Negotiable. Contract support is available. Full details: https://mmore.dev/en/classic2.html ◆ High Five — Private Build Private High Five build with years of live-server experience. Includes: • 100% official content • Full access to the project source code • Full technical support for the project • Bug fixing and feature development • Help with launch and long-term server development • A full professional development team working on your project • Java developers, datapack developers and project management • Many years of experience with large live projects • Long-term private cooperation and support Contract terms: Start: 3,000 USD Monthly contract: 3,000 USD / month Full details: https://mmore.dev/en/hf2.html ◆ Main / GOD — In Development Development of the Main / GOD branch, protocol 559+, has started. Pre-orders and sponsorship discussions are open. We accept only a limited number of projects from different regions with maximum regional exclusivity for each partner. IMPORTANT The latest Essence and Classic protocols are available only through long-term private contracts. Direct source code sales are available only for older protocols. If you need the newest protocols, active development, updates and support — contract work is the correct option. РУССКИЙ Ранее наша студия в основном занималась публичными сборками Lineage 2 и массовыми услугами разработки. Однако уже много лет основное направление нашей работы — приватная разработка для серьёзных проектов и инвесторов. Со временем мы ушли от работы на массовость и сосредоточились на качестве, стабильности, глубокой детализации и долгосрочном развитии проектов. Именно такой подход позволил нам создать продукты совершенно другого уровня, рассчитанные на крупные live-проекты и долгосрочную эксплуатацию. Сегодня помимо наших старых публичных сборок мы также предлагаем приватные enterprise-level решения, над которыми работает полноценная команда профессиональных разработчиков с многолетним опытом работы в сфере Lineage 2. Мы работаем только с серьёзными командами, инвесторами и проектами, которые понимают ценность качественной приватной разработки. ◆ L2 Essence — приватные сборки и исходники Актуальные протоколы: 557–559+ Доступны только на контрактной основе. Входит: • 100% реализация официального контента • Кастомные интерфейсные системы • Обновления протоколов на время действия контракта • Полный доступ к исходному коду проекта • Полная техническая поддержка проекта • Исправление ошибок и доработка функционала • Помощь с запуском и развитием сервера • Работа целой команды профессионалов над вашим проектом • Java-разработчики, datapack-разработчики и project management • Многолетний опыт работы с крупными live-проектами • Долгосрочная приватная работа и сопровождение проекта Условия контракта: Стартовый взнос: 10,000 USD Ежемесячно: 3,000 USD / месяц Старые протоколы Essence для прямой покупки исходников: • Протоколы 507–520 — 10,000 USD • Протоколы 474–502 — 7,000 USD • Протоколы 447–464 Seven Signs — 5,000 USD • Протокол 388 Crusade — 2,500 USD Подробнее: https://mmore.dev/essense2.html ◆ L2 Classic — приватные сборки и исходники Актуальные протоколы: 557–559+ Доступны только на контрактной основе. Входит: • 100% реализация официального контента • Кастомные интерфейсные системы • Обновления протоколов на время действия контракта • Полный доступ к исходному коду проекта • Полная техническая поддержка проекта • Исправление ошибок и доработка функционала • Помощь с запуском и развитием сервера • Работа целой команды профессионалов над вашим проектом • Java-разработчики, datapack-разработчики и project management • Многолетний опыт работы с крупными live-проектами • Долгосрочная приватная работа и сопровождение проекта Условия контракта: Стартовый взнос: 10,000 USD Ежемесячно: 3,000 USD / месяц Исходники Classic для прямой покупки: • Classic 542 protocol — 15,000 USD • Classic 520 protocol — 12,000 USD • Classic 507 protocol — 10,000 USD • Classic 286 protocol — 8,000 USD Торг возможен. Контрактная поддержка доступна. Подробнее: https://mmore.dev/classic2.html ◆ High Five — приватная сборка Приватная High Five сборка с многолетним опытом работы на живых проектах. Входит: • 100% официальный контент • Полный доступ к исходному коду проекта • Полная техническая поддержка проекта • Исправление ошибок и доработка функционала • Помощь с запуском и развитием сервера • Работа целой команды профессионалов над вашим проектом • Java-разработчики, datapack-разработчики и project management • Многолетний опыт работы с крупными live-проектами • Долгосрочная приватная работа и сопровождение проекта Условия контракта: Стартовый взнос: 3,000 USD Ежемесячно: 3,000 USD / месяц Подробнее: https://mmore.dev/hf2.html ◆ Main / GOD — в разработке Мы начали разработку ветки Main / GOD, протокол 559+. Открыты предварительные обсуждения, предзаказы и спонсорские контракты. Принимается ограниченное количество проектов из разных регионов мира с максимальной региональной эксклюзивностью для каждого партнёра. ВАЖНО Самые актуальные протоколы Essence и Classic доступны только на долгосрочном контракте. Прямая продажа исходного кода доступна только для более старых протоколов. Если вам нужны самые свежие версии, развитие, обновления и поддержка — выбирайте контрактную работу с нашей командой. CONTACTS / КОНТАКТЫ Telegram:  @L2scripts Microsoft Teams:   l2-scripts.com@outlook.com      Old Skype account: Urchika E-mail:    L2scripts.com@gmail.com IMPORTANT All discussions, project details, examples, testing access, source code demonstrations, technical discussions and cooperation terms are discussed strictly in Telegram only. We do not discuss private development publicly on the forum. Telegram is the main and preferred communication platform for all serious inquiries. ВАЖНО Все обсуждения, детали проектов, примеры, предоставление тестирования, демонстрации исходников, технические вопросы и условия сотрудничества обсуждаются строго только в Telegram. Публично на форуме приватная разработка не обсуждается. Telegram — основная и приоритетная платформа для связи по всем серьёзным вопросам. All questions are discussable. We work for the best Lineage 2 projects in the world.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..