Question

In: Computer Science

[15 marks] Draw the flowchart of the following programming problem: You can draw the flowchart using...

[15 marks] Draw the flowchart of the following programming problem: You can draw the flowchart using a drawing tool, or draw the flowchart on a piece of paper, take a picture, insert it here or save it in the submission folder The program reads an unspecified number of integers until a zero is entered. While the program reads each number it counts the number of positive numbers and the number of negative numbers that have been entered and sum up the values of the numbers entered. After the user enters zero, the program computes the average of the input values, not counting the zero. At the end the program displays the average, and the counts of positive numbers and negative numbers

Solutions

Expert Solution

Here is the flowchart for the above problem. It is created using Flowgorithm.

NOTE:

n is the total number of numbers entered by the user, sum and avg are the variables used to store the sum and the avg, respectively. Also, the while loop terminates when the user enters 0, until when it keeps count of all the negative numbers entered and the positive numbers entered. At the end of the loop, we display the results.

Here is a working example for the same:


Related Solutions

6. Write a program in C programming (compile and run), a pseudocode, and draw a flowchart...
6. Write a program in C programming (compile and run), a pseudocode, and draw a flowchart for each of the following problems: a) Obtain three numbers from the keyboard, compute their product and display the result. b) Obtain two numbers from the keyboard, and determine and display which (if either) is the smaller of the two numbers. c) Obtain a series of positive numbers from the keyboard, and determine and display their average (with 4 decimal points). Assume that the...
Develop an Algorithm and java program using Design Recipe for the following problems. Draw a flowchart...
Develop an Algorithm and java program using Design Recipe for the following problems. Draw a flowchart to compute the largest and smallest of 4 numbers : Write a Java Program for the above flowchart, use methods(functions), and nested if-else statements. Take input from the user using the Scanner object. Use separate methods to compute the Largest and Smallest of the numbers. Method 1 Name: findLargest(param 1, param 2, param 3, param 4) Method 2 Name: findSmallest(param 1, param 2, param...
Using the information given below draw and label a flowchart of the processes involved in production...
Using the information given below draw and label a flowchart of the processes involved in production of phthalic anhydride. Use boxes and/or other symbols to represent process units and lines with arrows to represent inputs and outputs. Indicate the process conditions. Phthalic anhydride (PA) is produced via partial oxidation of o-xylene using oxygen. The feed to the plant is o-xylene and air. Air is compressed to approximately 2 bar in a centrifugal compressor and heated to 360°C using high-pressure steam...
This problem will give you hands-on practice with the following programming concepts: • All programming structures...
This problem will give you hands-on practice with the following programming concepts: • All programming structures (Sequential, Decision, and Repetition) • Methods • Random Number Generation (RNG) Create a Java program that teaches people how to multiply single-digit numbers. Your program will generate two random single-digit numbers and wrap them into a multiplication question. The program will provide random feedback messages. The random questions keep generated until the user exits the program by typing (-1). For this problem, multiple methods...
In this assignment, you will practice solving a problem using object-oriented programming and specifically, you will...
In this assignment, you will practice solving a problem using object-oriented programming and specifically, you will use the concept of object aggregation (i.e., has-a relationship between objects). You will implement a Java application, called MovieApplication that could be used in the movie industry. You are asked to implement three classes: Movie, Distributor, and MovieDriver. Each of these classes is described below. The Movie class represents a movie and has the following attributes: name (of type String), directorsName (of type String),...
Can you please solve this using recursion/ dynamic programming? Any programming language is fine. Wallace the...
Can you please solve this using recursion/ dynamic programming? Any programming language is fine. Wallace the Weightlifting Walrus is training for a contest where it will have to lift 1000 kg. Wallace has some weight plates lying around, possibly of different weights, and its goal is to add some of the plates to a bar so that it can train with a weight as close as possible to 1000 kg. In case there exist two such numbers which are equally...
Problem 1. For each of the following examples, draw a representative isoquant. What can you say...
Problem 1. For each of the following examples, draw a representative isoquant. What can you say about the marginal rate of technical substitution in each case? 1. A firm requires exactly two full-time workers to operate each piece of machinery in the factory. 2. A firm can hire only full-time employees to produce its output, or it can hire some combination of full-time and part-time employees. For each full-time worker let go, the firm must hire an increasing number of...
Using C programming make one for loop Description For this problem you will be figuring out...
Using C programming make one for loop Description For this problem you will be figuring out if it is more beneficial to pay off your loans first before investing or if you should only make the minimum payments and invest the rest. Some things to pay attention to Interest rates given are annual interests rates but we will be assuming that interest is compounded monthly so the real rates to use will be 1/12 of what we are given We...
Solve the following linear programming problem using the dual simplex method: max ? = −?1 −...
Solve the following linear programming problem using the dual simplex method: max ? = −?1 − 2?2 s.t. −2?1 + 7?2 ≤ 6 −3?1 + ?2 ≤ −1 9?1 − 4?2 ≤ 6 ?1 − ?2 ≤ 1 7?1 − 3?2 ≤ 6 −5?1 + 2?2 ≤ −3 ?1,?2 ≥ 0
C programming: Using the following rules of the Dining philosophers problem: • N philosophers spend their...
C programming: Using the following rules of the Dining philosophers problem: • N philosophers spend their lives thinking and eating rice. • There are only N chopstick on the table, one between every two philosophers. • In order to eat, a philosopher needs to get hold of the two chopsticks that are closest to her. • A philosopher cannot pick up a chopstick that is already taken by a neighbor. Implement the dining philosophers problem using pthreads and monitor. Your...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT