C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 6, Problem 6.9E
Consider a 2-by-5 integer array t.
- Write a definition for t.
- How many rows does t have?
- How many columns does t have?
- How many elements does t have?
- Write the names of all the elements in the second row of t.
- Write the names of all the elements in the third column of t.
- Write a single statement that sets the element of t in row 1 and column 2 to zero.
- Write a series of statements that initialize each element of t to zero. Do not use an iteration statement.
- Write a nested for statement that initializes each element of t to zero.
- Write a statement that inputs the values for the elements of t from the terminal.
- Write a series of statements that determine and print the smallest value in array t.
- Write a statement that displays the elements of the first row of t.
- Write a statement that totals the elements of the fourth column of t.
- Write a series of statements that print the array t in tabular format. List the column indices as headings across the top and list the row indices at the left of each row.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Create an array containing the information of 5 books. The information includes name, ISBN, printing time, price and type. (information of books should be already in the code and not entered by user)
Output the information of the latest books, the information of the children's books, the information of IT books with the highest price.
Requirement:
Use C++ programming language
Use OOP to define Book class
JAVA
Your teacher has created two arrays, each holding the results of tests, say Test 1 and Test 2. You need to create a new array which holds the averages of these two tests. You may assume that the first element of the first test array refers to the student who also has the grade in the first element of the second test, and the last element in each array are the grades the last student earned for each test. All students received grades for both tests, meaning both test arrays are of the same length.
Complete the method, named makeAverage, in the class named Grades.java. There are two parameters to this method: the first is the integer array representing the grades of the first test, and the second is the array containing the grades of the second test. The new average array should be returned by the method. The grades should be treated as double variables.
For example, consider the test grades for the five students in the following arrays:
[ 87 ] [ 91 ] [ 76 ] [ 76 ] [ 94 ]…
made this program using Java:
. Hint: you can use array or any other structure.
Chapter 6 Solutions
C How to Program (8th Edition)
Ch. 6 - Fill in the blanks in each of the following: C...Ch. 6 - State which of the following are true and which...Ch. 6 - Write statements to accomplish each of the...Ch. 6 - Consider a 2-by-5 integer array t. Write a...Ch. 6 - (Sales Commissions) Use a one-dimensional array to...Ch. 6 - (Bubble Sort) The bubble sort presented in Fig....Ch. 6 - Write loops that perform each of the following...Ch. 6 - Prob. 6.13ECh. 6 - (Mean, Median and Mode Program Modifications)...Ch. 6 - (Duplicate Elimination) Use a one-dimensional...
Ch. 6 - Label the elements of 3-by-5 two-dimensional array...Ch. 6 - What does the following program do?Ch. 6 - What does the following program do?Ch. 6 - (Dice Rolling) Write a program that simulates the...Ch. 6 - (Game of Craps) Write a program that runs 1000...Ch. 6 - Prob. 6.21ECh. 6 - (Total Sales) Use a two-dimensional array to solve...Ch. 6 - (Turtle Graphics) The Logo language made the...Ch. 6 - Prob. 6.24ECh. 6 - (Knights Tour: Brute-Force Approaches) In Exercise...Ch. 6 - (Eight Queens) Another puzzler for chess buffs is...Ch. 6 - (Eight Queens: Brute-Force Approaches) In this...Ch. 6 - (Duplicate Elimination) In Chapter 12, we explore...Ch. 6 - (Knights Tour: Closed Tour Test) In the Knights...Ch. 6 - (The Sieve of Eratosthenes) A prime integer is any...Ch. 6 - Prob. 6.31RECh. 6 - (Linear Search) Modify the program of Fig. 6.18 to...Ch. 6 - (Binary Search) Modify the program of Fig. 6.19 to...Ch. 6 - Prob. 6.35RECh. 6 - Prob. 6.36RECh. 6 - Prob. 6.37RE
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Design a function to compare the contents of two stacks.
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
What is the difference between an instance member variable and a static member variable?
Starting Out with C++ from Control Structures to Objects (8th Edition)
Each repetition of a loop is known as a(n) ______. a. cycle b. revolution c. orbit d. iteration
Starting Out with Programming Logic and Design (4th Edition)
Account Balance A program that calculates the current balance in a savings account must ask the user for the fo...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Create a class SchoolKid that is the base class for children at a school. It should have attributes for the chi...
Java: An Introduction to Problem Solving and Programming (8th Edition)
This is an operator that raises a number to a power. a. % b. c. d. /
Starting Out with Python (4th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Assignment A scientist has developed a mathematical model for a physical process, and he wants to check how good is model is. To evaluate the correctness of his model, he wants to test the results of his model under certain parameters and compare them with experimental results. Write a program that first reads the number of tests (testCount) as an int followed by the results of each test according to the model as a double array (testModel) and finally the results of each test according to experiments as a double array (testExperiment). Then, the program should calculate the error of the model by evaluating the average of the absolute values (i.e., mutlak değer) of the differences between the model result and experimental result (see formula below) using a function. ItestModel,- textExperiment, testCount NOTE: Individual absolute value of the difference between the model value and the experiment value calculations MUST be done in the function. Every other functionality MUST be done in…arrow_forwardAssignment A scientist has developed a mathematical model for a physical process, and he wants to check how good is model is. To evaluate the correctness of his model, he wants to test the results of his model under certain parameters and compare them with experimental results. Write a program that first reads the number of tests (testCount) as an int followed by the results of each test according to the model as a double array (testModel) and finally the results of each test according to experiments as a double array (testExperiment). Then, the program should calculate the error of the model by evaluating the average of the ratio of absolute values (i.e., mutlak değer) of the differences between the model result and experimental result to the model result (see formula below) using a function. testCount testModel, - textExperiment, testModel, Error= Input testCount NOTE: Individual ratio of absolute value of the difference between the model value and the experiment value to the model…arrow_forward1. Create a struct called Booking that consists of a 3 digit flight number (e.g. 234), type of seat (E or B), the priceof a seat in economic class and the number of seats booked.Declare an array to store at least 30 Booking structs. (4)2. The user must be able to enter the information for a number of bookings from the keyboard. Ask whether abooking must be made (Y or N). If a booking must be made, a random 3 digit flight number must be generated.The user must be asked to enter the type of seat, the price per seat and the number of seats to book.3. Write code to display a numbered list with all the information of all the bookings. The price per ticket must bedisplayed with 2 decimal places. The output must be displayed with a heading and subheading 4. Write code to calculate and display the income earned per booking. Display headings and subheadings.Also count and display the number of business seats and economics seats booked as well as the incomeearned from each of these types of…arrow_forward
- Assignment 5A: Multiple Frequencies. In the last assignment, we calculated the frequency of a coin flip. This required us to have two separate variables, which we used to record the number of heads and tails. Now that we know about arrays, we can track the frequency of all numbers in a randomly generated sequence. For this program, you will ask the user to provide a range of values (from 1 to that number, inclusive) and how long of a number sequence you want to generate using that number range. You will then generate and save the sequence in an array. After that, you will count the number of times each number occurs in the sequence, and print the frequency of each number. Hints: You can use multiple arrays for this assignment. One array should hold the number sequence, and another could keep track of the frequencies of each number. Sample Output #1: What's the highest number you want to generate?: 5 How Long of a number sequence do you want to generate?: 10 Okay, we'll generate 10…arrow_forwardDeclare an array to hold the tax for up to 10 different sales.arrow_forwardEach of two players rolls a dice and whoever rolls the highest number (between 1 and 6 inclusive) gets 4 points, and if it is a draw, both players get 2 points. The player with the highest number of points after 10 rounds of the game is the winner (or the game could be drawn). The following arrays contain the results of dice rolls of each of two players in 10 consecutive rounds of the game.player1=[3, 2, 5, 6, 2, 5, 1, 6, 4, 5]player2=[4, 2, 4, 3, 6, 5, 3, 2, 4, 1] Write a MATLAB program that computes the running total points of each player and displays one of the following messages (whichever applies) after each round n for n = 1, 2, . . . , 10:Player 1 is leadingPlayer 2 is leadingIt is a tie [Hint: You should use an if construct.]Also, at the end of your program, use the find command to identify (and display) the rounds in which dice rolls were the same for the two players, and use the length command to compute (and display) the number of such rounds. Include appropriate headings in…arrow_forward
- Alert dont submit AI generated answer.arrow_forwardDebugging challenge: Consider the code example below. This program is designed to compare the contents of two arrays: if they are equal, the program should display "TRUE," if the arrays are not equal, the program should display "FALSE". However, even when the arrays have the same value, the program always prints "FALSE", regardless of the values in arrays a and b. What is going on here? What about the program causes the comparison to always fail? int a[4] {1, 2, 3, 4}; int b[4] = {1, 2, 3, 4}; if (a == b) { display ("TRUE"); else { display ("FALSE");arrow_forwardan int variable k, an int array currentMembers that has been declared and initialized, an int variable nMembers that contains the number of elements in the array, an int variable memberID that has been initialized, and a bool variable isAMember, Write code that assigns true to isAMember if the value of memberID can be found in currentMembers, and that assigns false to isAMemberotherwise. Use only k, currentMembers, nMembers, and isAMember.arrow_forward
- Java Program - Functions with 2D Arrays Write a function named displayElements that takes a two-dimensional array, the size of its rows and columns, then prints every element of a two-dimensional array. Separate every row by a new line and every column by a space. In the main function, write a program that asks for integer input to be assigned on a 3 x 3 array and call the function displayElements to print the contents on the next line. Input 1. Multiple lines containing integer each line Output R1C1: 1 R1C2: 2 R1C3: 3 R2C1: 4 R2C2: 5 R2C3: 6 R3C1: 7 R3C2: 8 R3C3: 9 1 2 3 4 5 6 7 8 9arrow_forwardCreate an array containing the information of 20 books. The information includes name, ISBN, printing time, price and type. Output the information of the latest books, the information of the children's books, the information of IT books with the highest price. Requirement: • Use C++ programming language • Use OOP to define Book classarrow_forward1.Enter a positive integer value n (6 <= n < 30) and take n integers from the user as input and store them in array a. Then move the elements of this array one step to the left and make the first element of the array the last element of the array. Shift this array with a function. Display integer value n, the array elements in original order and the array elements in modified order (after shifting). For example, if the original order of the array a is like below : a: 33 45 67 89 12 7 After shifting one step to the left, you should get the following order of the array а: a: 45 67 89 12 7 33arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
9.1: What is an Array? - Processing Tutorial; Author: The Coding Train;https://www.youtube.com/watch?v=NptnmWvkbTw;License: Standard Youtube License