Starting Out with Programming Logic and Design (4th Edition)
4th Edition
ISBN: 9780133985078
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 8.6, Problem 8.26CP
Program Plan Intro
Array: Array is a data structure that stores the sequence of similar type of data. It contains the sequence of data with common variable name and similar data type.
Syntax (in C++):
datatype arrayName[size] = {data1, data2,…,dataN};
Here,
datatype – Data type name
arrayName – Name of the array
size – It indicates the size of the array
Three dimensional arrays:
Two dimensional arrays contain three sets of data. The syntax for three dimensional array is given below.
Syntax (in C++):
datatype arrayName[SETS][ROWS][ELEMENTS];
Example: consider the array “xarray”.
int xarray[2][3][4];
Here, the array “xarray []” contains 2 sets of 3 rows. Each rows contains 4 elements.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
a class with 10 students that will take 3 exams use 3 arrays to hold the scores for each student and anoither array to hold the average of the 3 exams for each student. Print the table with the scores and average
Create three arrays of size 12 each. The first array will store the first year of energy costs, the second array will store the second year after going green, and the third array will store the difference. Also, create a string array that stores the month names.
Using the following two string arrays, output the first item from the first array with the first item from the second array on the same line (OUTPUT: red Ford). Then, output the second item from each array and output the result. Do this for all four items.
String[] firstArray = {“red”, “blue”, “yellow”, “black”};
String[] secondArray = {“Ford”, “Honda”, “GM”, “Toyota”};
Chapter 8 Solutions
Starting Out with Programming Logic and Design (4th Edition)
Ch. 8.1 - Prob. 8.1CPCh. 8.1 - Prob. 8.2CPCh. 8.1 - Prob. 8.3CPCh. 8.1 - Prob. 8.4CPCh. 8.1 - Prob. 8.5CPCh. 8.1 - Prob. 8.6CPCh. 8.1 - Prob. 8.7CPCh. 8.1 - What does array bounds checking mean?Ch. 8.1 - Prob. 8.9CPCh. 8.2 - Prob. 8.10CP
Ch. 8.2 - Prob. 8.11CPCh. 8.2 - What does the loop do in the sequential search...Ch. 8.2 - Prob. 8.13CPCh. 8.2 - How do you look for a partial string match when...Ch. 8.3 - Prob. 8.15CPCh. 8.3 - Prob. 8.16CPCh. 8.3 - Describe the algorithm for finding the highest...Ch. 8.3 - Prob. 8.18CPCh. 8.3 - Prob. 8.19CPCh. 8.4 - Prob. 8.20CPCh. 8.4 - Prob. 8.21CPCh. 8.5 - Prob. 8.22CPCh. 8.5 - Write a pseudocode statement that assigns the...Ch. 8.5 - Prob. 8.24CPCh. 8.5 - Prob. 8.25CPCh. 8.6 - Prob. 8.26CPCh. 8 - Prob. 1MCCh. 8 - Prob. 2MCCh. 8 - This is an individual storage location in an...Ch. 8 - Prob. 4MCCh. 8 - Prob. 5MCCh. 8 - Prob. 6MCCh. 8 - Prob. 7MCCh. 8 - Prob. 8MCCh. 8 - Prob. 9MCCh. 8 - Prob. 10MCCh. 8 - Prob. 1TFCh. 8 - Prob. 2TFCh. 8 - Prob. 3TFCh. 8 - Prob. 4TFCh. 8 - Prob. 5TFCh. 8 - Prob. 1SACh. 8 - Prob. 2SACh. 8 - Look at the following pseudocode: Constant Integer...Ch. 8 - Prob. 4SACh. 8 - Prob. 5SACh. 8 - Prob. 1AWCh. 8 - Prob. 2AWCh. 8 - Prob. 3AWCh. 8 - Prob. 4AWCh. 8 - Prob. 5AWCh. 8 - Prob. 6AWCh. 8 - Assume the following declarations appear in a...Ch. 8 - Design an algorithm for a function that accepts an...Ch. 8 - Write a pseudocode algorithm that uses the For...Ch. 8 - Prob. 1DECh. 8 - Prob. 2DECh. 8 - Prob. 3DECh. 8 - Total Sales Design a program that asks the user to...Ch. 8 - Lottery Number Generator Design a program that...Ch. 8 - Prob. 3PECh. 8 - Prob. 4PECh. 8 - Charge Account Validation Design a program that...Ch. 8 - Days of Each Month Design a program that displays...Ch. 8 - Payroll Design a program that uses the following...Ch. 8 - Drives License Exam The local drivers license...Ch. 8 - Saddle Points Design a program that has a...Ch. 8 - Tic-Tac-Toe Game Design a program that allows two...Ch. 8 - Lo Shu Magic Square The Lo Shu Magic Square is a...
Knowledge Booster
Similar questions
- Write an application that stores the following nine integers in an array: 10, 15, 19, 23, 26, 29, 31, 34, 38. Display the integers from first to last, and then display the integers from last to first.arrow_forwardCreate a program that will ask the user to input the average temperature a day and store it in an Array. Your array should contain days in a week and temperature each day. Display the average temperature in a week, and the day(s) with the highest temperature and lowest temperature.arrow_forwardThe Chat-A-While phone company provides service to six area codes and charges the per-minute rates for phone calls shown in Figure 6-25 (below). Write a program named ChatAWhile that stores the area codes and rates in parallel arrays and allows a user to enter an area code and the length of time for a call in minutes, and then display the total cost of the call. For example if the area code is in the array, such as 715, and the call length is 22 minutes, the output should be: Your phone call to area 715 costs $0.16 per minute For 22 minutes the total is $3.52 If the area code is not in the array, such as 111, the program should not accept a call length, and instead output Sorry - no calls allowed to area 111. Area Code Per-Minute Rate ($) 262 0.07 414 0.10 608 0.05 715 0.16 815 0.24 920 0.14 Figure 6-25 Per-minute phone call rates In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this,…arrow_forward
- Code a program that uses a 2D Array to record: A student’s name, mock score 1, mock score 2, mock score 3, the average score A grade is calculated based on the average and is also stored The contents of the array are read and displayed (1 line per student)arrow_forwardYou are given the following two dimensional arrays of people and their birth months: String [][] people = {{June, May, March, June, May, March, February, June, May, January, May, March}, {John, Mary, Peter, Bob, Sam, Dan, Judith, Gary, Tiff, Suzy, Jim, Jane}} 1) Create an enum type for the the first six months of the year 2) Randomly select a month from this enum 3) Loop through the array of people and make a list of all the people whose birthdays correspond to the month that was randomly chosen above. I ONLY NEED THE ANSWERS TO 2 AND 3. Please provide the codearrow_forwardA class with 10 students will take 3 exams. Use 3 arrays to hold the scores for each student and another array to hold the average of the 3 exams for each student. Print a table with scores and the average. SAMPLE OF HOW THE OUTPUT SHOULD BE STUDENT EXAM 1 EXAM 2 EXAM 3 AVERAGE 1 2 3arrow_forward
- In the composer array, create a statement that copies the string "Beethoven."arrow_forwardGiven the following array, int num[5]={3,6,9,12,15}, what will be the value of score for the given statement, score=num[3];arrow_forwardQuestion 1 (Marks: 30)Write a Java program to display three monthly sales of different vehicle types. The rows and columns represent the monthly sales of each vehicle type.JAN FEB MARSUV 25 15 35COUPE 25 55 35SEDAN 11 20 45VAN 17 27 25Using a Two-Dimensional array, produce the vehicle type sales report and the total sales made for each vehicle type. If the total sales made per month are greater than or equal to 100, gold statusis awarded. If the monthly sales are less than 100, silver status is awarded.arrow_forward
- You have FOUR people selling 5 different kinds of flowers, so instead of a 4 by 4 array you had in the video (4 rows and 4 columns) you now have a 4 by 5 array (4 rows and 5 columns ) You may either use the names I had in the video or choose your own. Instead of Brownies, you have flowers - petunia, pansy, rose, violet, and carnation. Use a random number generator to generate the numbers of flowers sold, print out all the data as I did in the video. The output should look like this: (numbers will vary because they are randomly generated) petunia pansy rose violet carnationFrankie 5 3 11 3 16 Janet 0 11 11 20 6 Sam 14 16 17 15 1 Abbie 8 20 0 6 8 Frankie sold 38 flowersJanet sold 48 flowersSam sold 63 flowersAbbie sold 42 flowers Total number of petunias sold: 27Total number of pansies…arrow_forwardThe most commonly used arrays in business applications are ____-dimensional and ____-dimensional. a. zero, one c. two, three b. one, two d. three, four If N is the number of variables in an array, the last variable of the array is assigned a subscript of ____. a. N-2 c. N b. N-1 d. N+1 The statement ____ assigns the character X to the first element of the letters array. a. letters[0] = 'X'; c. letters[1] = 'X'; b. letters[1] = "X"; d. letters[0] = "X"; A subscript is also called a(n) ____. a. iterator c. key b. index d. scalar When using bubble sort to sort an array in ascending order, at the end of the first pass, the ____ value is stored in the last position of the array. a. median c. largest b. mean d. smallest ____ declares and initializes a four-element string array named sales; each element is initialized to 0.0. a. string…arrow_forwardWrite an application that stores nine integers in an array. Display the integers from first tolast, and then display the integers from last to first.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage