Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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.

Java, Programming

  • Category:- Java
  • Reference No.:- M91544924

Have any Question?


Related Questions in Java

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Assignment - java program using array of objectsobjectives

Assignment - JAVA Program using array of objects Objectives - This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details - For this assignment, you are required to develop a Menu ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As