Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: In this lab you will create and modify a single file, song.java using an editor (emacs, vi, pico). You may have heard the children's

image text in transcribedimage text in transcribedimage text in transcribed

Problem: In this lab you will create and modify a single file, song.java using an editor (emacs, vi, pico). You may have heard the children's song: The wheel on the bus goes round round round round round round round round round The wheel on the bus goes round round round All through the town The wiper on the bus goes swish swish swish swish swish swish swish swish swish The wiper on the bus goes swish swish swish All through the town The horn on the bus goes beep beep beep beep beep beep beep beep beep The horn on the bus goes beep beep beep All through the town In this song each verse can be generated with two parameters X and Y, e.g. The X on the bus goes YYY YYY YYY The X on the bus goes YYY All through the town Example Program Solution Here is a sample that show you how your program could look. To get editor practice, you can just type it in. If you are lazy you can cut and paste the text. Although the java syntax is new, it is important that you understand what this program does - so ask if you have any questions. Try compling this program using the javac song.java command. Because this code imports a non-standard I/O library ("ann.easyio") it will generate some errors. Instead of using that library, you'll need to edit your program to make use of the standard I/O procedures. Use the error messages your code generates to identify the code associated with that strange library and replace it with the appropriate System.out.print calls. If you are not sure what a line of code does, try commenting it out to see. In this case, simply substitute System.out for S in the code, and deleted the definition of S and the line import ann.easyio. *. Make sure you have a working program before you continue with the lab. Your first real task is to modify the program so that, instead of making nine separate calls to verse in the main procedure you make only one (but produce the same output.) Do this by putting the eighteen parameters in a one dimensional array and looping over the array. You can follow the bones.java program example. Your second task is to extend this program so that it can also print verses like: The driver on the bus goes move on back move on back move on back The driver on the bus goes move on back All through the town Here, instead of repeating Y three times, Y it is only sung once. Write a new procedure that does this and add a call to this new procedure following the example above in your main procedure so that it prints an additional verse. (You need not store this procedure's parameters in an array.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

=+5. What is your impression of the Carbon Principles?

Answered: 1 week ago