1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
asambeis [7]
3 years ago
14

Ask the user how many high scores they want.

Computers and Technology
1 answer:
Alex3 years ago
6 0

Answer:

Check the explanation

Explanation:

As per requirement submitted above kindly find below solution.

Here new console application in C# is created using visual studio 2019 with name "HighScoreApp". This application contains a class with name "Program.cs".Below is the details of this class.

Program.cs :

//namespace

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

//application namespace

namespace HighScoreApp

{

class Program //C# class

{

//entry point of the program , Main() method

static void Main(string[] args)

{

//declaring variable to store number of score

int numberOfScores = 0;

//using while loop

while(numberOfScores<=0)

{

//asking user number of high scores

Console.WriteLine("Enter number of high scores : ");

//reading input

numberOfScores = int.Parse(Console.ReadLine());

}

//declaring array with number of scores

int[] scores = new int[numberOfScores];

//asking user high scores using for loop

for (int i = 0; i < scores.Length; i++)

{

//asking high scores

Console.WriteLine("Enter score "+(i+1)+" : ");

//reading score

scores[i] = int.Parse(Console.ReadLine());

}

Console.WriteLine();//used for new line

Console.WriteLine("High Scores -Unsorted");

//call function to print each element

PrintArray(scores);

//call method to sort the array elements

scores = SortArrayHighToLow(scores);

Console.WriteLine();//used to print new line

Console.WriteLine("High Scores-Sorted");

PrintArray(scores);//call method to print array elements

Console.SetCursorPosition(0, Console.WindowHeight - 1);

Console.WriteLine("Press ENTER to continue....");

Console.ReadLine();

}

//method to print the array

public static void PrintArray(int [] scoresArray)

{

//using for loop , print each score

for (int i = 0; i < scoresArray.Length; i++)

{

Console.WriteLine(scoresArray[i]);//print each high score

}

}

//method to sort the array

public static int [] SortArrayHighToLow(int[] scoresArray)

{

Array.Sort(scoresArray);

return scoresArray;

}

}

}

==================================

Output :Run application using F5 and will get the screen as shown below

Kindly check the below Screenshot for Output :Program.cs

You might be interested in
What is a blog that is set up for advertising purposes and used to send website links and other spam? A. splog B. adlog C. qlog
Alex_Xolod [135]

A. Splog. also known as "spam blog"

3 0
3 years ago
Read 2 more answers
Which question is most closely related to the field of biology? A.How thick is a paper bag? B.What determines the growth rate of
Andrei [34K]
B. What determines the growth rate of a fish population
6 0
3 years ago
Read 2 more answers
In a PowerPoint presentation, it is not possible to add notes that are hidden from the audience's view.
kvasek [131]

it actually is false i just checked

7 0
3 years ago
Why do we use console.log in javascript when changing variables?
Fiesta28 [93]
It helps to debug the code. Instead of going through every line of code to find an error, using console.log can tell us where to look.
8 0
3 years ago
Read 2 more answers
Fnaf ships anyone?<br><br> Idk I’m bored so please tell me I’m all ears ✨
zheka24 [161]
Foxy n mangle all the way.
4 0
3 years ago
Read 2 more answers
Other questions:
  • Which OS function does a CLI fulfill? A User interface B Running applications C Hardware interface D Booting
    12·1 answer
  • Question 4 (2 points)
    6·2 answers
  • What's the best option if you can't show your PowerPoint presentation at all? A. Create PDF/XPS Document B. Prepare a Package Pr
    11·2 answers
  • A(n) _______ is the most basic type of access query
    13·1 answer
  • Xavier buys a computer for $525, which includes taxes. He pays for the computer over a 12-month period by paying $48.13 per mont
    8·2 answers
  • Andrew’s Complete Cameras offers its customers an interactive website to help them choose the best camera for their lifestyle. B
    5·1 answer
  • Why is it difficult to convince top management to commit funds to develop and implement a Strategic Information System
    13·1 answer
  • True or false a weighted inventory system is often tied into player advancement
    15·1 answer
  • 4. True or False: In order to use wi-fi signal/network, you have to remain seated in one spot.
    6·1 answer
  • What is Utility Software ? Name any two utility programs. <br>​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!