Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Declare a 8x8 two dimensional array of strings named chessboard

09/11/2020 Client: papadok01 Deadline: 3 days

CPSC 120 Spring 2014

Lab 8

Name _____________________________

Practice Objectives of this Lab:

1. Arrays Hold Multiple Values

2. Accessing Array Elements

3. Inputting and Displaying Array Contents

4. Array Initialization

5. Processing Array Contents

6. Using Parallel Arrays

7. Two-Dimensional Arrays

Grading:

1. 8.1 10 points

8.2-7.7 15 points each

100 points totally

2. Your final complete solution report is due before your lab in next week(April. 27—May.3rd).

To begin

· Log on to your system and create a folder named Lab8 in your work space.

· Start the C++ IDE (Visual Studio) and create a project named Lab8.

· Please refer to the PPTs, Chapter 8 in our Textbook.

LAB 8.1– TRY IT: You do not need to complete all of them (at least 60%). These questions help you review the basic concepts in Arrays.

1. Declare an array named scores of twenty-five elements of type int .

2. Write a statement that declares an array of char named streetAddress that contains exactly eighty elements .

3. Given the array a , write an expression that refers to the first element of the array .

4. Given an array a , declared to contain 34 elements , write an expression that refers to the last element of the array .

5. Assume that the array arr has been declared . In addition, assume that ARR_SIZE has been defined to be an integer that equals the number of elements in arr . Write a statement that assigns to x the value of the next to last element of the array ( x has already been declared ).

6. Assume that the array monthSales of integers has already been declared and that its elements contain sales data for the 12 months of the year in order (i.e., January, February, etc.). Write a statement that writes to standard output the element corresponding to October. Do not write anything else out to standard output .

7. Given that an array of int named a has been declared , assign 3 to its first element .

8. Assume that an array of int variables named salarySteps that contains exactly five elements has been declared . Write a single statement to assign the value 30000 to the first element of this array .

9. Assume that an array of integers named salarySteps that contains exactly five elements has been declared . Write a statement that assigns the value 160000 to the last element of the array salarySteps .

10. Assume that an array named a , containing exactly five integers has been declared and initialized . Write a single statement that adds ten to the value stored in the first element of the array .

11. Given that an array of int named a has been declared , and that the integer variable n contains the number of elements of the array a, assign -1 (minus one) to the last element in a.

12. Assume that an array of int named a has been declared with 12 elements and that the integer variable k holds a value between 0 and 6. Assign 15 to the array element whose index is k .

13. Given that an array of int named a has been declared with 12 elements and that the integer variable k holds a value between 0 and 6. Assign 9 to the element just after a[k] .

14. Assume that an array of integers named a that contains exactly five elements has been declared and initialized . Write a single statement that assigns a new value to the first element of the array . This new value should be equal to twice the value stored in the last element of the array . Do not modify any values in the array other than the first element .

15. Suppose v is an array with 100 int elements. If 100 is assigned to v[100], what happens? image1.wmf The compiler issues an error message. image2.wmf The compiler issues a warning message. image3.wmf The program will terminate immediately. image4.wmf Another variable or array will very likely be unexpectedly modified.

16. QUESTION 1:

An array of 1000 integers is declared. What is the largest integer that can be used as an index to the array? image5.wmf 1001 image6.wmf 1000 image7.wmf 999

17. QUESTION 2:

Consider the declaration: int v[1]; What is the index of the last element of this array? image8.wmf 0 image9.wmf 1 image10.wmf 2

18. Declare an array named a of 10 elements of type int and initialize the elements (starting with the first) to the values 10, 20, ..., 100, respectively.

19. Declare an array named taxRates of 5 elements of type double and initialize the elements (starting with the first) to the values 0.10, 0.15, 0.21, 0.28, 0.31, respectively.

20. Write a statement to declare and initialize an array of int named denominations that contains exactly six elements . Your declaration statement should initialize the elements of the array to the following values : 1, 5, 10, 25, 50, 100. (The value 1 goes into the first element ; the value 100 to the last.)

21. Given an array temps of double , containing temperature data, and an int variable n that contains the number of elements in temps : Compute the average temperature and store it in a variable called avgTemp . Besides temps , n , and avgTemp , you may use only two other variables -- an int variable k and a double variable total , which have been declared .

22. Reversing the elements of an array involves swapping the corresponding elements of the array : the first with the last, the second with the next to the last, and so on, all the way to the middle of the array . Given an array a , an int variable n containing the number of elements in a , and two other int variables , k and temp , write a loop that reverses the elements of the array . Do not use any other variables besides a , n , k , and temp .

23. Declare a 8x8 two-dimensional array of strings named chessboard.

24. Given a two-dimensional array x of doubles , write an expression whose value is twice the value of the element in the 3rd row and the 2nd column.

25. Gi ven a two-dimensional array x of element type int , write an expression whose value is the sum of the element in the 3rd row and4th column and the element in the 5th rowand 1st column.

26. Given a two-dimensional array x of element type int with 5 rows and 4 columns, write an expression whose value the last element in the array (the last column of the last row).

27. Given a two-dimensional array x of element type double , and two integer variables i and j , write an expression whose value is the i-th element in the j-th row.

28. Given a two-dimensional array of integers named q , with 2 rows and 4 columns, write some code that puts a zero in every element of q . Declare any variables needed to help you.

29. You are given a 6x8 (6 rows, 8 columns) array of integers , x , already initialized and three integer variables : max , i and j . Write the necessary code so that max will have the largest value in the array x .

Please do the following few Programming Projects in the following way.

1) Pseudocode of your program (20% grading);

2) Your C++ source code (include your name, section number, CSUF email, lab number and date (60% grading);

3) Screenshots gotten using any reasonable testing cases or as required (20% grading)

8.2 (15 points) Write a short program that prompts the user and reads in integers into an array called Table. When the user enters a negative number, the input stops. Keep track of how many numbers were read in (at least 5 and no more than 10; what size should you declare the array to have?)

--At least 1 screenshot for testing

8.3 (15 points) Based on your solution of 8.2, add code to do the following (only include your complete pseudocode after step 4 in your report):

1) Print how many numbers were read in, and then print out all the numbers that were stored in the array.

2) Find and print the sum of the numbers in the array.

3) Find the average of the numbers in the array. (Make sure the average is a real number, not an integer.)

4) Then find and print how many of the numbers are less than the average calculated above, how many are exactly the same value as the average, and how many were greater than the average. Test and make sure it works.

--At least 1 screenshot for each step’s testing (totally 4)

8.4 (15 points) Add code to do the following based on your solution of exercise 8.3:

Ask the user for a value and see if it is in the array. If found, the program should print “Found at” followed by the index where the value was found. Ask the user whether to repeat and keep repeating if the user wants to. (The body of the loop would be:

Asking user for a value and reading it in.

Searching for the value in the array and printing either “Not found.” or “Found at index ….”. Asking user whether to continue and reading in the answer.)

Test using different values. At a minimum, test using the following values:

a. value not in the array.

b. the first value of the array,

c. the last value in the array

d. value in the array somewhere between the first and the last values.

--At least 1 screenshot for each case’s testing (totally 4)

8.5 (15 points) Add code to do the following based on your solution of exercise 8.4:

Find and print the smallest value in the array AND the index where it is located. Then write code that will swap the smallest value and the first value in the array.

--At least 1 screenshot for testing

8.6 (15 points) Programming Challenges of Chapter 8 # 4 Monkey Business (Page 587)

image11.png

8.7 (15 points) Write a program that reads in sales for different items in a chain of 6 stores. This means that you read in an item ID, a one word description, the item price, followed by 6 numbers representing the number of that item sold at the 6 stores. Keep reading in item data until the user enters -1 where the item ID should be.

Sample input:

4715 toy_car 3.00 7 4 3 6 5 6

6813 birthday_card 2.00 16 8 15 4 12 19

-1

You should use an array for all the IDs, an array of strings for the item description, another array for the prices, and a 2D array for the sales. These should be parallel arrays; that is, the item with its ID stored at index 2 will have its item description at index 2, its price in the price array at index 2, and the numbers of that item sold will be in the row 2.

1) First write code that will print out the data, reproducing the input pattern (that is, the first row will print out the ID, price, and sales for the first item. Use it to check that the input went correctly.

(2 testing screenshots)

2) Now add to the program an interactive loop, asking what data the user wishes to see. Choice 1 should be the complete array contents you wrote for the previous problem.

(1 testing screenshot)

3) Then for the other choices (one choice should be able to quit), you will write the code for the following tasks that use the arrays.

1) Given an item ID, print out the total sales for that item for the whole chain. (2 testing screenshots)

2) Given one store (0, 1, … 5), print the actual $ values the sales represents for each item.

(2 testing screenshots)

3) Given one store, print out the item that had the largest total $ value of the sales.

(2 testing screenshots)

4) Given an item, print out the store that sold the most and the store that sold the fewest.

(2 testing screenshots)

1

_1459571805.unknown
_1459571807.unknown
_1459571808.unknown
_1459571806.unknown
_1459571803.unknown
_1459571804.unknown
_1459571801.unknown
_1459571802.unknown
_1459571800.unknown
_1459571799.unknown

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Quality Homework Helper
Buy Coursework Help
Custom Coursework Service
Finance Homework Help
Writer Writer Name Offer Chat
Quality Homework Helper

ONLINE

Quality Homework Helper

Hi dear, I am ready to do your homework in a reasonable price.

$62 Chat With Writer
Buy Coursework Help

ONLINE

Buy Coursework Help

Hi dear, I am ready to do your homework in a reasonable price.

$62 Chat With Writer
Custom Coursework Service

ONLINE

Custom Coursework Service

Hey, Hope you are doing great :) I have read your project description. I am a high qualified writer. I will surely assist you in writing paper in which i will be explaining and analyzing the formulation and implementation of the strategy of Nestle. I will cover all the points which you have mentioned in your project details. I have a clear idea of what you are looking for. The work will be done according to your expectations. I will provide you Turnitin report as well to check the similarity. I am familiar with APA, MLA, Harvard, Chicago and Turabian referencing styles. I have more than 5 years’ experience in technical and academic writing. Please message me to discuss further details. I will be glad to assist you out.

$55 Chat With Writer
Finance Homework Help

ONLINE

Finance Homework Help

I have a Master’s degree and experience of more than 5 years in this industry, I have worked on several similar projects of Research writing, Academic writing & Business writing and can deliver A+ quality writing even to Short Deadlines. I have successfully completed more than 2100+ projects on different websites for respective clients. I can generally write 10-15 pages daily. I am interested to hear more about the project and about the subject matter of the writing. I will deliver Premium quality work without Plagiarism at less price and time. Get quality work by awarding this project to me, I look forward to getting started for you as soon as possible. Thanks!

$55 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

"Behavioral Finance" and "Body of Knowledge" essay - No growth philosophy of management - Benjamin Franklin - Www tenement org research html - More than meets the eye worksheet answers - Does microsoft have preferred stock - Avant garde literal translation - Strayer outline - Uow subject database 2021 - Asian united food service woolner nt - Sean moriarty family report writer - How strong are the competitive forces confronting lululemon - Legal, Regulations, Investigations, and Compliance - Build a molecule phet - Aqa gcse exam dates 2014 - Www warsaw k12 in us guided reading - Die 5 besten Tipps für Online Casinos: Was ist zu beachten? - Week7 6053 - Discussion lll - Oasis academy don valley - Major programming error from the last five years - 5 1 midway company performance summary powerpoint - Tensile coupon test specimen - Blum hinge machine parts - Strange travelers david blaine revealed - Family trainer wii download - 3.22 miles in km - Fairchild v glenhaven funeral services ltd - 7 3 skills practice similar triangles - Week 3 Project - Economics in Healthcare Setting - Second step program research - Simpson's diversity index example - Dr kalman rubin engagement - Acc 250 week 1 assignment - Sar health services switzerland - Read Chapter 4 and 5 and complete the review questions. - Distance vector routing algorithm in c - 60601 2 edition 4 - INFORMATICS - Flocabulary romeo and juliet - Developing pricing strategies and programs - Political factors affecting business - Moral status of the fetus - Yoky matsuoka net worth - Cognitive development interview questions - Through the arc of the rainforest sparknotes - You ll never walk alone karaoke female version - Pursuit of happyness movie length - Discussion 2 ( Business Law) - Diffusion of innovation theory everett rogers - How to do a mock trial in the classroom - Stan steele musician - Accounting generally has the responsibility for - Energy is transferred from the sun to earth mainly by - Humn 8660 - Cossham birth centre bristol - Muir graphic organizer a prezi - George ritzer globalization the essentials pdf - As 2293.1 free download - Reorganization - Daniel o donnell fan mail address - Laser eye surgery albury - Ey lease accounting guide asc 840 - Naidoc week 2015 theme - Examples of irony in the lottery - Sonance outdoor speaker removal - Democritus birth and death date - ESRD - Oxidation state of central metal ion - Global warming - Prepare an incremental analysis for cisco - South lanarkshire holidays 2014 - Ssd bharat bazar / tandoori express - Nhs cultural competence - Science lab safety rules poem - Cadbury schweppes americas beverages - Carolina windom 40 plus - Black belt candidate taekwondo - An ant on a picnic table travels 30cm eastward - Bulk bill psychologist central coast nsw - Kandon enterprises inc has two operating divisions - Financial accounting chapter 5 homework solutions - Going global lessons from late movers - Two blondes were driving to disneyland explanation - Theoretical framework in research example - Crescive norms - Four steps in managing external stakeholder relationships - The good immigrant student bich minh nguyen - What is 0.4 is 10 times as much as - Charismatic leadership steve jobs - Packet tracer 6.3 1.10 answers - Chem 5 june 2015 - Co operative registration forms - Research paper on the Access control for Data storage in Clouds - Islamic environmental ethics law and society - El enfermero le la temperatura al paciente. (tomar, ir) - I need help with managerial Finance assignment. - Infant feeding guidelines for health workers - Mt baw baw parking - Anthropology