Question: Please Write the code in JAVA The Florida Tech Tram Service (FTTS) is loosing money at a alarming rate because of low ridership. However, on
Please Write the code in JAVA
The Florida Tech Tram Service (FTTS) is loosing money at a alarming rate because of low ridership. However, on some routes the passengers are complaining that some trams are full and they have to wait for the next tram! The administration wants to fix this. They asked Dr. Stansifer to gather reliable data about ridership. Several graduate student were hired to gather data about the tram stops of a given route: The counted the number of riders you got off the tram, the number who boarded the tram, and the number who had to wait because there was no space on the tram at that time. As the data came in, Dr. Stansifer became suspicious that the graduate students were not bothering to travel to the trams stops, but instead were just making up the data. Dr. Stansifer decided to enlist the help of CSE1002 students to test whether or not the data was consistent. Data is inconsistent, if: - more passengers got off than were on the tram, - more passengers got on than the capacity of the tram, or - any passengers waited unnecessarly The tram should start and finish the journey empty, in particular passengers should not wait for the tram at the last station. Your tasks is to write a Java program to check the inconsistency of the data gathered for one tram route with N stops where the tram can hold C passengers. (The FTTS trams can be extremely large!) Input All input will be taken from the standard input stream. The first line contains two integers C and N, the total capacity (0C109) and the number of stops is ( 2N100 ). The next N lines contain three integers each: the number of people that left the tram, entered the tram, and stayed at a stop. All these integers are in the range between 0 and 109 inclusive. The lines in the input are given in the same order as the tram visits each stop. Output One line containing one word: possible if the data is consistent, impossible otherwise Sample Input and Output Input 1: 10121010 Output 1: possible
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
