Question: in java 7 . 1 1 Write statements that perform the following one - dimensional - array operations: Set the 1 0 elements of integer

in java
7.11 Write statements that perform the following one-dimensional-array operations:
Set the 10 elements of integer array counts to zero.
Add one to each of the 15 elements of integer array bonus.
Display the five values of integer array bestScores in column format.
7.12(Duplicate Elimination) Use a one-dimensional array to solve the following problem: Write an application that inputs five numbers, each between 10 and 100, inclusive. As each number is read, display it only if its not a duplicate of a number already read. Provide for the worst case, in which all five numbers are different. Use the smallest possible array to solve this problem. Display the complete set of unique values input after the user enters each new value.
7.13 Label the elements of three-by-five two-dimensional array sales to indicate the order in which theyre set to zero by the following program segment:
1 for (int row =0; row < sales.length; row++){
2 for (int col =0; col < sales[row].length; col++){
3 sales[row][col]=0;
4}
5}
7.14(Variable-Length Argument List) Write an application that calculates the product of a series of integers that are passed to method product using a variable-length argument list. Test your method with several calls, each with a different number of arguments.
7.15(Command-Line Arguments) Rewrite Fig. 7.2 so that the size of the array is specified by the first command-line argument. If no command-line argument is supplied, use 10 as the default size of the array.
7.16(Using the Enhanced for Statement) Write an application that uses an enhanced for statement to sum the double values passed by the command-line arguments. [Hint:Use the static method parseDouble of class Double to convert a String to a double value.]
7.17(Dice Rolling) Write an application to simulate the rolling of two dice. The application should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12, with 7 being the most frequent sum, and 2 and 12 the least frequent. Figure 7.28 shows the 36 possible combinations of the two dice. Your application should roll the dice 36,000,000 times. Use a one-dimensional array to tally the number of times each possible sum appears. Display the results in tabular format.
Fig. 7.28
The 36 possible sums of two dice.
Figure 7.28 Full Alternative Text
7.18(Game of Craps) Write an application that runs 1,000,000 games of craps (Fig.6.8) and answers the following questions:
How many games are won on the first roll, second roll, ..., twentieth roll and after the twentieth roll?
How many games are lost on the first roll, second roll, ..., twentieth roll and after the twentieth roll?
What are the chances of winning at craps? [Note: You should discover that craps is one of the fairest casino games. What do you suppose this means?]
What is the average length of a game of craps?
Do the chances of winning improve with the length of the game?
7.19(Airline Reservations System) A small airline has just purchased a computer for its new automated reservations system. Youve been asked to develop the new system. Youre to write an application to assign seats on each flight of the airlines only plane (capacity: 10 seats).
Your application should display the following alternatives: Please type 1 for First Class and Please type 2 for Economy. If the user types 1, your application should assign a seat in the first-class section (seats 15). If the user types 2, your application should assign a seat in the economy section (seats 610). Your application should then display a boarding pass indicating the persons seat number and whether its in the first-class or economy section of the plane.
Use a one-dimensional array of primitive type boolean to represent the seating chart of the plane. Initialize all the elements of the array to false to indicate that all the seats are empty. As each seat is assigned, set the corresponding element of the array to true to indicate that the seat is no longer available.
Your application should never assign a seat that has already been assigned. When the economy section is full, your application should ask the person if its acceptable to be placed in the first-class section (and vice versa). If yes, make the appropriate seat assignment. If no, display the message
"Next flight leaves in 3 hours.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!