Tomorrow, December 7, is the International Civil Aviation Day.
1. Describe at least two events from the history of computing, and how these events affected the field of computing.
2. The total weight of a plane is equal to the weight of a plane itself plus the overall weight of the passengers -- computed as the average passenger weight times the number of passengers. Write a method that takes, as input, the weight of the plane itself, the number of passengers, and the average weight of the passengers, and returns the total weight of the plane. Trace this method on the example of a small plane that weighs 200 kg and has 2 passengers of average weight 70 kg. Hints:
3. (related to Problem 2) Define a class Airplane in which each object has three private fields: weightOfPlane, averageWeight, and numberOfPassengers. Your code for defining the class should contain:
4. Dr. Kreinovich was originally planning to fly to a conference in Houston to present his joint paper with Dr. Longpre, but it turns out that he cannot go, so Dr. Longpre will fly instead. It is therefore necessary to change a ticket. Write a piece of code that, given a string ticket that contains the last name Kreinovich exactly once, replaces this name with Longpre.
5. (related to Problem 4). Write a method that swaps the values of two globally defined string variables flies and stays. Trace your method on the example when originally the contents of the string variable flies is "Kreinovich", and the contents of the string variable stays is "Longpre".
6. It is recommended that a passenger who is not checking in luggage arrives at the airport:
7. The passenger list for a flight is contained in a file:
8. Write a method that takes, as the input, the array of passenger weights, and returns the average weight of the passengers. Assume that there are no empty spots in the array. Assuming that a weight can be from 1 kg to 150 kg, and the number of passengers can be from 1 to 10, what are the reasonable test cases for this method? Give specific examples of the corresponding test arrays.
9. Use the algorithms that we learned in class to translate 12 and 7 into binary, add these numbers in binary, and translate the sum back into decimal (to check the correctness of the result). Suppose that a computer has only one decimal significant digit, and it uses round-off; if you ask this computer to add 12.0 and 7.0, what will be the result?
10. Is it ethical to copy your lab assignments from someone else or from the web and present it as your own? Is it ethical, instead of buying a copyrighted textbook, to download it, for free, from a webpage where it is illegally posted? For each of these two cases, present: