Java Exam Practice Example2. Toll Road Management смотреть онлайн
Example 2: Toll Road Management
Write a program to manage payments on toll roads. All classes must belong to package tollroad
R1 - Customer management
Interaction with the system takes place through class TollManager. New customers can be added by means of method addCustomer, which accepts as arguments the SSN, first and last name.
It is possible to access information about a user, given her SSN, through method getCustomer. This method returns the last name of the customer and throws the CustomerNotPresent exception if the customer is not present.
R2 - Segment management
It is possible to add new segments through the method addSegment that accepts the code of the segment, the name of the starting location, the name of the arrival location, and the toll price.
By means of method getSegment() it is possible to get the price of a segment given its code, if there is no segment with the given code a SegmentNotPresent exception is thrown.
R3 - Payment management
The transit of a customer through a segment can be signaled by means of the method transitOnSegment(), which accepts as arguments the customer's SSN, and the segment code.
The corresponding toll price must be added to the customer's debit. Each customer has a given credit threshold (10.0 by default or set through method setCreditThreshold()); if the customer debit is greater than the credit threshold the method throws a CreditThresholdReached exception after having incremented the debit.
Method totalDebt() returns the total debt accumulated by a customer.
Method countTransit() returns the number of transits made by a customer.
Method segments() returns the set of codes of segments passed by a customer (without repetitions)
Method resetCustomer() resets the record of segment transits and the customer's debit.
All the above methods in R3 accept as argument the customer SSN and throw a CustomerNotPresent exception.
R4 - Statistics
Method countTransit() returns the total number of tansits recorded by the system.
Method totalDebt() returns the sum of all debits.
Method mostTransitedSegment() returns the code of the segment having the highest number of transits recorded by the system. In case of tie the first code in alphabetic ordered is returned.
Source Code is available here : https://github.com/niranjk/TollRoad
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java Exam Practice Example2. Toll Road Management» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.