On November 6, 1893, Pyotr Ilyich Tchaikovsky, a well-known Russian composer, died during a cholera epidemic. He died a few days after the premiere of his Sixth Symphony "Pathetique", a piece full of suffering and pain. In the US, Tchaikovsky is most known for his music for the Nutcracker ballet -- usually performed at Christmas time, and for his 1812 Overture, often performed on July 4.
1a. Many of his musical pieces -- e.g., all his symphonies -- consist of several parts (called "movements"). Write a method named average that, given the total duration d of a piece and the number of parts p in this piece, returns the average duration of a movement.
1b. The Sixth Symphony lasts 46 minutes and consists of 4 movements. Call (invoke) your method average in the main method to compute the average duration of each movement. You do not need to write the entire main method, just the part that assigns values to the corresponding variables duration and parts and calls your method.
1c. Trace, step by step, how the computer will perform the needed computations, and check that the result is indeed correct.
2a. Define a class Symphony whose objects are different symphonies written by Tchaikovsky. The description of each symphony should contain its title, its duration, and the number of parts (movements). Your class should contain a constructor method, get- and set-methods, and a method for computing the average duration of a movement.
2b. Use your class in the main method to define a new object pathetique of type Symphony describing Tchaikovsky's Sixth Symphony that lasts for 46 minutes and consists of 4 movements. Compute and print the average duration of a movement. El Paso Symphony performed it in 48 minutes. Replace 46 with the new value 48, and compute and print the new average duration of a movement.
2c. Trace your program step-by-step.
3a. Write a piece of code that, given an array duration of durations of different symphonies and an array parts of numbers of movements in different symphonies, creates a new array av consisting of average durations of a movement in each symphony. Assume the arrays duration and parts have been declared, initialized, and that they have the same length.
3b. To check the correctness of the code you wrote in Part 3a, write a piece of code that defines a new array duration with values 46 and 60 and a new array parts with elements 4 and 5.
3c. Trace step-by-step how the piece of code you wrote in Part 3a will compute the corresponding average durations.
4a. Which of Tchaikovsky's symphonies is the longest? Write a method that, given an array d of durations of different symphonies and the array t of their titles, returns the title of the longest symphony. Assume the arrays have been declared, initialized, and have the same non-zero length.
4b. To check the correctness of your method, write a piece of code that defines new arrays duration consisting of 3 elements 46, 60, and 40, and titles with elements P, C, and X.
4c. Trace step-by-step how the piece of code you wrote in Part 4a will find the title of the longest symphony.
5a. Describe what is white-box and black-box testing.
5b. Describe the main rules for testing.