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 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...
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...
IN JAVA!! You may be working with a programming language that has arrays, but not nodes....
IN JAVA!! You may be working with a programming language that has arrays, but not nodes. In this case you will need to save your BST in a two dimensional array. In this lab you will write a program to create a BST modelled as a two-dimensional array. The output from your program will be a two-dimensional array.   THEN: practice creating another array-based BST using integers of your choice. Once you have figured out your algorithm you will be able...
You are asked to develop a React App as follow: 1) Create a new component, name...
You are asked to develop a React App as follow: 1) Create a new component, name it YournameComp to the program which extract the Weather info from Weather API (Open Weather Map), and display the current temperature. Upon calling the component, a webform appears which asks user to enter a city name and select the country code (from a drop-down list) and when the user hits the show temperature button, the data will be displayed. 2) Add a Route to...
x86 irvine library assembly code Write a complete program that: 1. Prompt the user to enter...
x86 irvine library assembly code Write a complete program that: 1. Prompt the user to enter 10 numbers. 2. save those numbers in a 32-bit integer array. 3. Print the array with the same order it was entered. 3. Calculate the sum of the numbers and display it. 4. Calculate the mean of the array and display it. 5. Rotate the members in the array forward one position for 9 times. so the last rotation will display the array in...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT