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
alexdok [17]
2 years ago
11

Write a program that include a method that returns the sum of all the elements of a Linked List of Integers. Allow the user to e

nter the integers to be added to your Linked List from the console (max of 10 integers). Test your program and display your integers and the sum results.
Computers and Technology
1 answer:
Illusion [34]2 years ago
8 0

Answer:

static void Main(string[] args)

       {

           //declare a blank linked list

           LinkedList<int> numList = new LinkedList<int>();

           Console.WriteLine("Enter the Numbers");

           //check if the size of the linkedlist is 10

           while(numList.Count < 10)

           {

               //read the input supplied by the user

               string val = Console.ReadLine();

               //check if the input is integer

               if(int.TryParse(val, out _) == false)

               {

                   //if not integer, display error message and prompt for new number

                   Console.WriteLine("Invalid number");

                   continue;

               }

               //add the inputted number to the linkedlist

               numList.AddLast(int.Parse(val));

               

           }

           //call the method for linkedlist sum and display it

           Console.WriteLine(SumLinkedList(numList));

           Console.Read();

       }

       //method for linkedlist summation

       private static int SumLinkedList(LinkedList<int> val)

       {

           //declare sum as zero

           int sum = 0;

           //loop through the linkedlist to display the num and sum all numbers

           foreach(int item in val)

           {

               Console.Write(item + " ");

               sum += item;

           }

           return sum;

       }

   }

Explanation:

program written with c#

You might be interested in
Please complete the following questions. It is important that you use complete sentences and present the questions and answers w
Vanyuwa [196]

Answer:

well... i came for the same answer

Explanation:

7 0
2 years ago
Read 2 more answers
Comet Computer Company will make a splash with psychedelic laptop cover designs scheduled for release next year. The computers d
valkas [14]

Answer:

Packaging.

Explanation:

The following system corporation should allow the sensation of psychedelic laptop case patterns planned for these upcoming year's publication. The machines may not disclose any further variations in features from what the following corporation provides. The above effort illustrates using Packaging that distinguishes a commodity as fresh.

So, the following answer is correct according to the given statement.

6 0
3 years ago
A large global retail corporation has experienced a security breach, which includes personal data of employees and customers.
sergeinik [125]

The act that  Accenture would offer as the best solution to ensure enhanced security in the future is Data Protection program.

<h3>What is Accenture  about?</h3>

In Keeping client data protected, Accenture’s Information Security Client is known to be well built up with Data Protection program that can help client teams with a good approach and the security controls, etc.

Therefore, The act that  Accenture would offer as the best solution to ensure enhanced security in the future is Data Protection program.

Learn more about Accenture from

brainly.com/question/25682883

#SPJ1

5 0
2 years ago
Which is the last step in conducting a URL search?
dimulka [17.4K]
The user's browser renders the html code as a visual web page
3 0
3 years ago
I need help with Python. The first image is the code and the 2nd is the output.
Gekata [30.6K]
The issue arises because the string you are trying to print is not a string, rather a float value. Item1, item2 and item3 are strong values (if you type some alphabets in it and not just numbers), but itemonecost, itemtwocost, and itemthreecost are explicitly type casted to float. In line 22, 23, and 24 you’re trying to print a float, by adding it with the string. One cannot add numbers to string. Rather you can type cast the itemcost to string while printing.

Add str(itemonecost) instead of itemonecost in print statement. Do this for other float variables too.

However do note that there are multiple ways to correct this issue, and I’ve just pointed one out.
4 0
3 years ago
Other questions:
  • Don is the superintendent of the county school system. What task might Don
    8·1 answer
  • In Word, tables can be styled much like text can.<br> True<br> False
    6·1 answer
  • 5. Which of the following could occur making it necessary for Amy to troubleshoot her computer? Error messages keep popping up,
    12·1 answer
  • Can Word Processing (WP) programs be used for DTP? Explain your answer
    7·1 answer
  • 12) If the image's name is filename.gif, how can I make this image the background of my page?
    6·1 answer
  • 1. Se requiere implementar un conversor unipolar que tendrá una tensión analógica variable entre 0 y 2 V pico. Deberá tener una
    10·1 answer
  • How to make a project using PID and thermacouple
    11·1 answer
  • Provide a status report to your classmates and instructor. Describe any modifications that you have made to the design or docume
    10·1 answer
  • If int a = 4, int *b = &amp;a , int **c= &amp;b;<br> what is the value store in c.
    15·1 answer
  • Look at the picture ​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!