Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CISY 103 – Lab02 CISY 105 – Lab07 Chapter 7 Purpose  To use a partially filled array to hold int or double data entered by the user  To calculate the average of an array of int or double Overview...

1 answer below »
CISY 103 – Lab02
CISY 105 – Lab07
Chapter 7
Purpose
 To use a partially filled a
ay to hold int or double data entered by the user
 To calculate the average of an a
ay of int or double
Overview
Collect a series of int or double values from the user until the user enters a sentinel value when done. Display back to the user what they entered. Calculate and display the average value.
Technical Items
 For this lab you can write 1 file that has a main method
 You must use an A
ay [ not A
ayList ] of int or double
 Your A
ay must be able to hold up to 10 items
 You must use a sentinel value so the user can indicate they have finished entering data
 Do not allow the user to overfill the a
ay (see Sample Run 3)
 If a user enters no data, note that (see Sample Run 2)
 On the output back to the user display a header and show the index
 After the displayed a
ay show the average
Ru
ic
 name in a comment at the top (2 points)
 Class/file name (5 points)
(naming convention starts with upper case, subsequent words upper case)
 Variable Declarations (15 points)
(datatypes and naming convention starts with lower case, subsequent words upper case, variables declared at top of method)
 Declaration/Allocation of an A
ay [ not A
ayList ] of 10 int/double items (10 points)
 Sentinel controlled loop for entry of data from the user (20 points)
 Not allowing the user to overfill the a
ay (see Sample Run XXXXXXXXXXpoints)
 For the output back to the user display a header (5 points)
 For the loop that outputs back to the user their values, display the index and the value from the a
ay(15 points)
 Calculate and show the average of the values entered (5 points)
 If a user enters no data, note that (see Sample Run 2) (5 points)
 proper indenting (8 points)
· body of class indented, body of methods indented, body of loop indented
Deviations
Instead of fruit sold which is used in the samples, you can use a different “theme” as long as you meet the technical requirements of the program. Example: Puppies bought or Zombies killed [ keep it clean and professional please]
Sample Run 1 (no fruit)
Enter the number of fruits sold(-1 when done): -1
What? you didn't sell any fruit!
Sample Run 2
Enter the number of fruits sold(-1 when done):81
Enter the number of fruits sold(-1 when done):60
Enter the number of fruits sold(-1 when done):75
Enter the number of fruits sold(-1 when done):58
Enter the number of fruits sold(-1 when done):32
Enter the number of fruits sold(-1 when done):5
Enter the number of fruits sold(-1 when done):94
Enter the number of fruits sold(-1 when done):-1
Fruit
# Sold
===== ======
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
Average Fruits Sold: 57.9
Sample Run 3 (filled a
ay)
Enter the number of fruits sold(-1 when done):432
Enter the number of fruits sold(-1 when done):257
Enter the number of fruits sold(-1 when done):659
Enter the number of fruits sold(-1 when done):854
Enter the number of fruits sold(-1 when done):715
Enter the number of fruits sold(-1 when done):336
Enter the number of fruits sold(-1 when done):954
Enter the number of fruits sold(-1 when done):157
Enter the number of fruits sold(-1 when done):511
Enter the number of fruits sold(-1 when done):27
A
ay is full!
Fruit
# Sold
===== ======
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
Average Fruits Sold: 490.2
Submitting the La
You must submit the .java file on Canvas.
Cheating and Late Policies
Please see the syllabus for the Cheating Policy (don't cheat) and the Late Policy (-10 pts per calendar day)
Page 1
Answered Same Day Mar 27, 2021

Solution

Aditi answered on Mar 28 2021
125 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here