answer.
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
valina
1 month ago
6

6. Write pseudo code that will perform the following. a) Read in 5 separate numbers. b) Calculate the average of the five number

s. c) Find the smallest (minimum) and largest (maximum) of the five entered numbers. d) Write out the results found from steps b and c with a message describing what they are.
Computers and Technology
1 answer:
zubka84 [942]1 month ago
8 0

Answer:

Pseudo CODE

a)

n= Input “Enter 5 integer values”

b)

sum=0.0

For loop with i ranging from 0 to 5

Inside loop sum=n[i]+sum

Outside loop avg=sum/5

Print avg

c)

small=n[0] # assume initial number is the smallest

large=n[0] # assume initial number is the largest

For loop with i ranging from 0 to 5

Inside loop if n[i]<small # check if current number is smaller than small

Inside if Then small=n[i]

Inside loop if n[i]>large # check if current number is larger than large

Inside if then large=n[i]

Print small

Print large

d)

print avg

print small

print large

You might be interested in
Leah Jones is the IT manager at Rock Solid Outfitters, a medium-sized supplier of outdoor climbing and camping gear. Steve Allen
Natasha_Volkova [897]

Answer:

Step 1: Create a table reflecting the three potential scenarios and two possible outcomes. There should be a total of 8 distinct rules for the three varying conditions, structured similarly to the discount table shown here in the example: attached is the discount table

Step 2: The rules can now be made simpler by taking the following aspects into account:

a) When a consumer completes the survey form AND opts into the newsletter, according to Rules 1 and 2, they qualify for a discount if their order exceeds $100. This leads to two distinct rules being formulated while the third condition (order quantity) holds significance.

b) If the buyer fills out the survey form OR subscribes to the newsletter, as indicated by Laws 3, 4, 5, and 6, they will benefit from free shipping, regardless of the order amount. As a result, this situation can be divided into two individual rules, where at least one requirement is satisfied, but not both.

c) When a customer fails to meet any requirements, corresponding to Rules 7 and 8, the order value will not qualify for either free shipping or discount. This can be seen as a single law. The linked simplification table illustrates this.

7 0
14 days ago
Debug the program so it prints the factorial of a positive integer entered by the user. This is calculated by multiplying all th
Natasha_Volkova [897]
The primary issue was declaring int prod within the while loop, which caused prod to reset to 1 each time the loop executed.
3 0
21 day ago
Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is:teamWins / (teamWin
amid [800]

Answer:

Explanation:

public class Team {

   private String teamName;

   private int teamWins;

   private int teamLosses;

   public String getTeamName() {

       return teamName;

   }

   public void setTeamName(String teamName) {

       this.teamName = teamName;

   }

   public int getTeamWins() {

       return teamWins;

   }

   public void setTeamWins(int teamWins) {

       this.teamWins = teamWins;

   }

   public int getTeamLosses() {

       return teamLosses;

   }

   public void setTeamLosses(int teamLosses) {

       this.teamLosses = teamLosses;

   }

   public double getWinPercentage() {

       return teamWins / (double) (teamWins + teamLosses);

   }

}

7 0
13 days ago
A company moves a popular website to a new web host. Which of the following will change as a result?
8_murik_8 [892]
The root name server.
3 0
20 days ago
A method countDigits(int num) of class Digits returns the remainder when the input argument num(num &gt; 0) is divided by the nu
ivann1987 [930]

Answer:

#include <iostream>

using namespace std;

class Digits

{

   public:

   int num;

   int read()       //method to read num from user

   {

       cout<<"Enter number(>0)\n";

       cin>>num;

       return num;

   }

   int digit_count(int num)  //method to count number of digits of num

   {

       int count=0;

       while(num>0)    //loop till num>0

       {

           num/=10;

           count++;   //counter which counts number of digits

       }

       return count;

   }

   int countDigits(int num)   //method to return remainder

   {

       int c=digit_count(num); //calls method inside method

       return num%c;  

   }

};

int main()

{

   Digits d;    //object of class Digits is created

   int number=d.read();   //num is read from user

   cout<<"\nRemainder is: "<<d.countDigits(number);  //used to find remainder

   return 0;

}

Output:

Enter number(>0)

343

Remainder is: 1

Explanation:

The program has a logical error that needs rectification. A correctly structured program calculates the remainder when a number is divided by the count of its digits. A class named Digits is created, consisting of the public variable 'num' and methods for reading input, counting digits, and calculating the remainder.

  • read() - This function asks the user to enter the value for 'num' and returns it.
  • digit_count() - This function accepts an integer and counts how many digits it has, incrementing a counter until 'num' is less than or equal to 0. It ultimately returns the digit count.
  • countDigits() - This function takes an integer and delivers the remainder from dividing that number by its digit count. The digit count is computed using the 'digit_count()' method.

Finally, in the main function, a Digits object is instantiated, and its methods are utilized to produce an output.

7 0
1 month ago
Other questions:
  • An author is preparing to send their book to a publisher as an email attachment. The file on their computer is 1000 bytes. When
    6·1 answer
  • Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp
    6·1 answer
  • Splunk In most production environments, _______ will be used as the source of data input?
    12·1 answer
  • Suppose that a scheduling algorithm (at the level of short-term CPU scheduling) favors those processes that have used the least
    10·1 answer
  • What type of memory can support quad, triple, and dual channels?
    5·1 answer
  • The following code is intended to test if x is NOT less than 17. Fill in the correct symbol:
    14·2 answers
  • Assign to avg_owls the average owls per zoo. Print avg_owls as an integer. Sample output for inputs: 1 2 4 3
    7·1 answer
  • A 2-dimensional 3x3 array of ints, has been created and assigned to tictactoe. Write an expression whose value is true if the el
    10·1 answer
  • What is a commonly publicized password sql injection string?
    10·1 answer
  • Explain what might happen if two stations are accidentally assigned the same hardware address?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!