Question

C# Lab 7A: Thank you, Grace Hopper. You may have heard the story, but the programming...

C#

Lab 7A: Thank you, Grace Hopper. You may have heard the story, but the programming term “bug” is attributed to the computer legend Grace Hopper who, after diagnosing the problem with a program, determined it was because a bug (in this case, a moth) physically wedged itself under a vacuum tube – causing the machine to no longer work. We’ve come a long way since then...

For this part of the lab, you are going to write a program, then show what it looks like using the debugger. So, in addition to your code, you’re going to have to submit a screenshot of the debugger.

Start by writing the following program: prompt the user for the size of an integer array, declare an array of that size, then populate each cell of the array with the square of the cell’s index (e.g. cell 0 = 0, cell 1 = 1, cell 2 = 4, cell 3 = 9). Finally, print out the contents of the array separated by the “pipe” symbol (above the Enter key) on a single line. The program should behave like the sample output below. User input is denoted in bold.

C++ students: see the appendix for example code of creating an array based off of a user variable.

Use the debugger: Once your program is working, you must set a breakpoint in your code (preferably the line that is printing out each cell), then start walking through the code. Just before the program is finished, show the array in the debugger – with each cell holding the correct value (i.e. expand the array in the debugger, just like in the video). Take a screenshot of it and save it to your desktop. In addition to your code, you will need to submit this image.

Sample #1:
Enter the size of the array: 5 |0|1|4|9|16

Sample #2:
Enter the size of the array: 14 |0|1|4|9|16|25|36|49|64|81|100|121|144|169

  

Homework Answers

Answer #1

SOLUTION-
I have solve the problem in C# code with screenshot for easy understanding :)

CODE-

//c# code
using System;
class HelloWorld {
static void Main() {
      Console.Write("Enter the size of array: ");
      int n= Convert.ToInt32(Console.ReadLine());
      int[] a= new int[n];
      int i;
      for(i=0;i<n;i++)
      {
        a[i]=i*i;
      }
     for(i=0;i<n;i++)
     {
         Console.Write("{0}|",a[i]);
     }
}
}

SCREENSHOT-

IF YOU HAVE ANY DOUBT PLEASE COMMENT DOWN BELOW I WILL SOLVE IT FOR YOU:)
----------------PLEASE RATE THE ANS
WER-----------THANK YOU!!!!!!!!----------

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In this lab, you complete a partially prewritten C++ program that uses an array. The program...
In this lab, you complete a partially prewritten C++ program that uses an array. The program prompts the user to interactively enter eight batting averages, which the program stores in an array. The program should then find the minimum and maximum batting average stored in the array as well as the average of the eight batting averages. The data file provided for this lab includes the input statement and some variable declarations. Comments are included in the file to help...
In C programming, Thank you Write a program to compute the area of a circle. You...
In C programming, Thank you Write a program to compute the area of a circle. You have to write a complete “C” program that compiles and runs in Codeblocks. Program requirements: 1. Declare the variables needed: radius (r) and area (yourLastName). 2. Calculate and print the area of each circle. 3. The program MUST prompt the user for a new radius (r) over and over until the user types -1. 5. Use the type double for all decimal numbers. 6....
Using C++, Python, or Java, write a program that: In this programming exercise you will perform...
Using C++, Python, or Java, write a program that: In this programming exercise you will perform an empirical analysis of the QuickSort algorithm to study the actual average case behavior and compare it to the mathematically predicted behavior. That is, you will write a program that counts the number of comparisons performed by QuickSort on an array of a given size. You will run the program on a large number of arrays of a certain size and determine the average...
Objectives: In this lab, you need to modify your functions (createArray, getArraySize, and freeArray) based your...
Objectives: In this lab, you need to modify your functions (createArray, getArraySize, and freeArray) based your pre-lab. In createArray function, an integer array needs to be created with its size and the maximum value in this array stored in front as two integers. After creating the array, your array should look like this: max size Array[0] Array[1] ... Array[n-1] You also need to modify the other two functions accordingly. Main program steps: 1.Create an array like mentioned above with 10...
n this lab, you use what you have learned about parallel arrays to complete a partially...
n this lab, you use what you have learned about parallel arrays to complete a partially completed C++ program. The program should: Either print the name and price for a coffee add-in from the Jumpin’ Jive Coffee Shop Or it should print the message Sorry, we do not carry that. Read the problem description carefully before you begin. The file provided for this lab includes the necessary variable declarations and input statements. You need to write the part of the...
This programming task will be a bit different. It will be more like what you would...
This programming task will be a bit different. It will be more like what you would receive if you were a maintenance engineer working in a corporate information systems or technology department. In other words, you will have some prebuilt source code provided for you that you must alter so it will meet the given programming specification.. Build a program from what you have been given as a starting-point. Rename the “starter code”. Do not add any modules; just, use...
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF...
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF A RUNNING COMPILER QUESTION: 1) Fibonacci sequence is a sequence in which every number after the first two is the sum of the two preceding ones. Write a C++ program that takes a number n from user and populate an array with first n Fibonacci numbers. For example: For n=10 Fibonacci Numbers: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 2): Write...
PLEASE POST IN C++ : Thank you!! 5.27 LAB*: Program: Soccer team roster (Vectors) This program...
PLEASE POST IN C++ : Thank you!! 5.27 LAB*: Program: Soccer team roster (Vectors) This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers in one int vector and the ratings in another int vector. Output these vectors (i.e., output...
I need this before the end of the day please :) In Java 10.13 Lab 10...
I need this before the end of the day please :) In Java 10.13 Lab 10 Lab 10 This program reads times of runners in a race from a file and puts them into an array. It then displays how many people ran the race, it lists all of the times, and if finds the average time and the fastest time. In BlueJ create a project called Lab10 Create a class called Main Delete what is in the class you...
Topics Arrays Accessing Arrays Description Write a C++ program that will display a number of statistics...
Topics Arrays Accessing Arrays Description Write a C++ program that will display a number of statistics relating to data supplied by the user. The program will ask the user to enter the number of items making up the data. It will then ask the user to enter data items one by one. It will store the data items in a double array. Then it will perform a number of statistical operations on the data. Finally, it will display a report...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT