Question

A student is taking 3 courses this semester. He has 3 tests in the first courses,...

A student is taking 3 courses this semester. He has 3 tests in the first courses, 2 tests in the second course and 4 tests in the third course. Write a C# program to do the following. Create a jagged two-dimensional array to store test scores of this student. Write statements to ask the student to enter his test scores. Store the scores in the array. Write statements to display the scores.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace std_score_in_jagged_arr
{
class Program
{
static void Main(string[] args)
{
int i,j;
int[][] jag = new int[3][];
jag[0] = new int[3];
jag[1] = new int[2];
jag[2] = new int[4];

for (i = 0; i < 3; i++)
{
Console.Write("Enter scores for Course 1 Test " + (i + 1));
jag[0][i] = Convert.ToInt32( Console.ReadLine());
}
for (i = 0; i < 2; i++)
{
Console.Write("Enter scores for Course 2 Test " + (i + 1));
jag[1][i] = Convert.ToInt32(Console.ReadLine());
}
for (i = 0; i < 4; i++)
{
Console.Write("Enter scores for Course 3 Test " + (i + 1));
jag[2][i] = Convert.ToInt32(Console.ReadLine());
}


for (i = 0; i < 3; i++)
{
Console.Write("\nEnter scores for Course 1 Test " + (i + 1)+"are"+jag[0][i]);
  
}
for (i = 0; i < 2; i++)
{
Console.Write("\nEnter scores for Course 2 Test " + (i + 1) + "are" + jag[1][i]);
  
}
for (i = 0; i < 4; i++)
{
Console.Write("\nEnter scores for Course 3 Test " + (i + 1) + "are" + jag[2][i]);
  
}
Console.ReadKey();
}
}
}

Add a comment
Know the answer?
Add Answer to:
A student is taking 3 courses this semester. He has 3 tests in the first courses,...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • CSC888 has 4 people. Each person needs to take 3 tests. Create a 4-by-3 two-dimensional array...

    CSC888 has 4 people. Each person needs to take 3 tests. Create a 4-by-3 two-dimensional array to store the test scores. Ask the user to enter test scores one at a time to populate this array. Once the whole array is filled, do the following two things. (1) For each student, display her test scores and the average of the three tests. (2) For each test, display student scores and the average of the four students. The following shows a...

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

  • Implement a C program to calculate the Average Score Point(ASP) of a student taking N courses...

    Implement a C program to calculate the Average Score Point(ASP) of a student taking N courses in a semester. Ask the user for the number of courses(N) the student is taking in the semester, and check if the number of courses is greater than 1 (>1). If the number of courses is less than or equal to 1(<=1), display an error and ask the user to try again until the right input is entered. Next, ask the user for the...

  • (JAVA) Write a program that maintains student test scores in a two-dimesnional array, with the students...

    (JAVA) Write a program that maintains student test scores in a two-dimesnional array, with the students identified by rows and test scores identified by columns. Ask the user for the number of students and for the number of tests (which will be the size of the two-dimensional array). Populate the array with user input (with numbers in {0, 100} for test scores). Assume that a score >= 60 is a pass for the below. Then, write methods for: Computing the...

  • Java Programing Code only Ragged Array Assignment Outcome: Student will demonstrate the ability to create and...

    Java Programing Code only Ragged Array Assignment Outcome: Student will demonstrate the ability to create and use a 2D array Student will demonstrate the ability to create and use a jagged array Student will demonstrate the ability to design a menu system Student will demonstrate the ability to think Program Specifications: Write a program that does the following: Uses a menu system Creates an array with less than 25 rows and greater than 5 rows and an unknown number of...

  • c++ Instructions Overview In this programming challenge you will create a program to handle student test...

    c++ Instructions Overview In this programming challenge you will create a program to handle student test scores.  You will have three tasks to complete in this challenge. Instructions Task 1 Write a program that allocates an array large enough to hold 5 student test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the...

  • Write a C++ program that asks user number of students in a class and their names....

    Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....

  • Write a c++ program which uses a structure having the indicated member names to store the...

    Write a c++ program which uses a structure having the indicated member names to store the following data: Name (student name) IDnum (student ID number) Tests (an array of three test scores) Average (average test score) Grade (course grade) The program will keep a list of three test scores for one student. The program may prompt the user for the name, ID number, and test scores, or these may be assigned within the program. The average test score will be...

  • Write a program that will calculate each student’s average score over several tests. The program will...

    Write a program that will calculate each student’s average score over several tests. The program will ask for the number of students, and the number of scores per student. Then, for each student, it will ask for all test results and display the average. The output should look similar to what is shown below (sample user input is shown in bold) ( write by python and Screenshot it for me , thank) How many students do you have? 3 How...

  • C++ Programming

    PROGRAM DESCRIPTIONIn this project, you have to write a C++ program to keep track of grades of students using structures and files.You are provided a data file named student.dat. Open the file to view it. Keep a backup of this file all the time since you will be editing this file in the program and may lose the content.The file has multiple rows—each row represents a student. The data items are in order: last name, first name including any middle...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT