In a method named setfavoritesports declare

Assignment Help JAVA Programming
Reference no: EM13876401

Purpose:  To learn how to create, populate, and access arrays using value-receiving and value-returning methods. 

Lab Exercise 6.2 Instructions:  Code a program that prompts the user for the size of the array.  Using the size, the program creates several arrays that will store information about your favorite sports and teams.  There will be one array for the sport, another for the team, and the last one for the year of your team's last championship.  The values in each array at the same location are for a given sport.  Once the arrays are populated, print the information from each array.  The size and input will be the only global variables.  Use printf().  Code your program according to the specifications below.  Use the looping structure generally associated with array processing.  Name the programYourLastNameFirstInitialLE62.java.  The methods will be called from the main().

1st Input Prompt:  Code this in a method named arraySize().  

How many sports are you interested in? 

2nd Input Prompt:  In a method named setFavoriteSports declare the sports array and populate it.  This method will return the sports array to the calling statement.  The 9 in the prompt below will print 1 for the first sport, then 2 for the 2nd one and so forth.  Use the loop-control variable as the value for 9. 

Enter sport #9: 

3rd Input Prompt:  In a method named setFavoriteTeams declare the teams array and populate it.  The Xs in the prompt is the sport.  ThesetFavoriteTeams method will return the teams array to the calling statement as well as receive the sports array from the calling statement.  

Enter your favorite Xxxxxxxxxx team: 

4th Input Prompt:  In a method named setLastChampionship declare the year array and populate it.  The Xs in the prompt is the team name.  The setLastChampionship method will return the year array to the calling statement as well as receive the team array from the calling statement.  This method will be called as an argument in the call to printSportsTeams(). 

Enter the year of the Xxxxxxxxxxxx' last championship: 

Output Specifications:  Where the Xs represent the sport and team and the Zs the year.  Code the output print statement in a method named printSportsTeams() that accepts the sports, teams and year arrays.  In the printSportsTeams method use a for loop to print the information from each array.  The print for the header has to be outside of the for loop because it's printed only once. 


MY SPORTS TEAMS

Sport:  Xxxxxxxxxxxx
Team:  Xxxxxxxxxxxx
Last Championship:  ZZZ9

Sport:  Xxxxxxxxxxxx
Team:  Xxxxxxxxxxxx
Last Championship:  ZZZ9

***END OUTPUT SPECS***

Sample Output:  Follow the spacing and line advances indicated in this output.

Reference no: EM13876401

Questions Cloud

Gallery expects to bring in additional cash flows : Cortez Art Gallery is adding to its existing buildings at a cost of $2 million. The gallery expects to bring in additional cash flows of $520,000, $700,000, and $1,000,000 over the next three years. Given a required rate of return of 10 percent, what..
Create a class called student : Java Create a class called Student that contains: - A field to store the name - A field to store their average numerical grade
Assume poisson properties apply : Leaks occur along a pipeline at the mean rate of 0.5 leaks per mile. Assume Poisson properties apply. What is the probability that a 3 mile stretch will have no leaks? (to four decimal places)
Value bond outstanding with coupon rate : Yan Yan Corp. has a $10,000 par value bond outstanding with a coupon rate of 5.2 percent paid semi annually and 28 years to maturity. The yield to maturity on this bond is 4.3 percent. What is the price of the bond?
In a method named setfavoritesports declare : In a method named setFavoriteSports declare the sports array and populate it.  This method will return the sports array to the calling statement.  The 9 in the prompt below will print 1 for the first sport, then 2 for the 2nd one and so forth.  Use t..
Dimensional array lab : Change the program (AirlineDriver.java) to assign passenger seats in an airplane. Chesapeake Airlines is a small commuter airline with seats for 20 passengers in 5 rows of 4 seats each. Here is the layout:
East and west. bmi has a cost of capital : Back Mountain Industries (BMI) has two divisions: East and West. BMI has a cost of capital of 15%. Selected financial information (in thousands of dollars) for the first year of business follows:
Provide a dollar estimate of the annual cost savings : Provide a dollar estimate of the annual cost savings associated with the recently enacted quality improvements. Show calculations.
Did anyone different get admitted : Is this enough information to determine who should get into the University? If not what other information would you want and why

Reviews

Write a Review

JAVA Programming Questions & Answers

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Write java program to receive input and displayed interest

Write a Java program that receive some input and displayed the interest. Format the number into 2 decimal places. Using loop is an advantage.

  What is a generic subprogram in java

How do you describe as a type in C++ a pointer to a function that takes two ints as arguments and returns a double. What is a generic subprogram in Java. What are its advantages

  Implement/update specific methods for the dfs of a graph

show the DFS order of vertices in the graph, and for each node, specify its parent node in the search (the node from which the currect node was reached). Moreover, display for each node the discovery and finishing time, to check that the Parenthesis ..

  Accepts a string as its parameter and returns an integer

Write a method in java named secondHalfLetters that accepts a string as its parameter and returns an integer representing how many of letters in the string come from the second half of the alphabet

  Java class to accept a user-s hourly rate of pay

Write a class that accepts a user's hourly rate of pay and the number of hours worked. Display the user's gross pay, the withholding tax (15% of gross pay), and the net pay (gross pay - withholding).

  Example of a problematic programming situation or scenario

Suggest one (1) example of a problematic programming situation or scenario that the use or implementation of a sequence structure could resolve

  What are some resources to cover mental health issues

What are some resources to cover mental health issues in the criminal justice system? Provide a timeline for the resources that will cover the issue.

  Develop class which implements interface

Let the ADT called SquareMatrix. (The matrix can be represented by 2-D array of ints w/ n rows and n columns.) Write specification for ADT as Java interface. Develop the class which implements interface.

  Java program that allows the user to enter a letter

Write a java program that allows the user to enter a letter (as a code) and a real number (as the radius of a circle). If the letter is 'A' your program must calculate the area of the circle. If the letter is 'C' your program must calculate the ci..

  Java graphics-write an application that extends jframe and

java graphics-write an application that extends jframe and that displays a phrase in every font size from 6 through

  Guess the number game

The user interface is displayed and the user clicks the "Start Game" button to begin the game - Your application then gets a random number in the range 1-1000 inclusive

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd