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
Goryan [66]
3 years ago
10

Write a program that displays the middle value of three unduplicated input values. Hint: Review the four solutions in the smalle

st number case study in this chapter. Consider how easy or hard it would be to modify each of those algorithms to find the middle value rather than the smallest value. Then modify the algorithm you consider most appropriate for this problem.
Computers and Technology
1 answer:
kkurt [141]3 years ago
5 0

Answer:

The code is in java.

Explanation:

import java.util.Scanner;  

class Main{  

   public static void main(String[] args) {

       System.out.println("Enter 3 different numbers");

       Scanner obj = new Scanner(System.in);

       int a = obj.nextInt();

       int b = obj.nextInt();

       int c = obj.nextInt();

       System.out.println("The middle element is : ");

       //Check if a is the middle

       if(a>b&&a<c || a>c&&a<b){

           System.out.println(a);

       }

       //Check if b is the middle element

       else if(b>a&&b<c || b<a&&b>c){

           System.out.println(b);

       }

       else{

           System.out.println(c);

       }

   }

}  

OUTPUT:-

You might be interested in
Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, one coin
Serjik [45]

Answer:

Here is the Python program:

def FewestCoinVals():  # function to output change using fewest coins

 total_change = int(input('Enter change amount in pennies: '))

#prompts user to enter total change amount in pennies

 if total_change <= 0:  # if value of total_change is less or equal to 0

   print('no change')  # prints no change

 else:  # if value of total_change is greater than 0

   dollars = total_change // 100  

#calculate value of dollars by dividing total_change by 100

   total_change %= 100   #take mod of value of total_change with 100

#calculate value of quarters by dividing total_change by 100

   quarters = total_change // 25

   total_change %= 25  #take mod of value of total_change with 25

#calculate value of dimes by dividing total_change by 100

   dimes = total_change // 10  

   total_change %= 10  #take mod of value of total_change with 10

#calculate value of nickels by dividing total_change by 100

   nickels = total_change // 5

   total_change %= 5  #take mod of value of total_change with 5

   pennies = total_change  

#value of pennies is equal to value of total_change

#the if elif statement checks for the singular and plural coin names

   if dollars >1:

       print('dollars: ',dollars)

   elif dollars ==1:

       print('dollar: ',dollars)

   if quarters > 1:

       print('quarters: ',quarters)

   elif quarters ==1:

       print('quarter: ',quarters)

   if dimes >1:

       print('dimes: ',dimes)

   elif dimes ==1:

       print('dime: ',dimes)

   if nickels >1:

       print('nickels: ',nickels)

   elif nickels ==1:

       print('nickel: ',nickels)

   if pennies >1:

       print('pennies: ',pennies)

   elif pennies ==1:

       print('penny: ',pennies)

#calls the FewestCoinVals() function        

FewestCoinVals()

                     

Explanation:

The program prompts the user to enter change amount in pennies and has int() function to convert input value to integer.  If the value entered is less than or equal to 0 it displays message "no change", otherwise it converts the value using fewest coins. The formulas for converting to each type is given in the code. It uses if and elif statements to check if the final value of total_change has singular or plural coin names such as penny or pennies. The program along with output is attached as the screen shot.

3 0
3 years ago
PLS HELP: Identify the correct CSS syntax to link an external style sheet??
kupik [55]

Answer:

See Explanation

Explanation:

This question required options. Since there are none, I'll answer on a general terms.

To link to an external style sheet in CSS, use the following syntax:

<link rel = "stylesheet" type = "text/css" href = "link to css file">

As seen above, the link tag is used to achieve this tax.

The rel attributes shows the relationship between the css file and the html file.

In this case, the css file is a stylesheet; hence, rel = "stylesheet"

Next, is the type attribute which shows the content of the file to be linked. In other words, the file type

Lastly, the link to the css file.

Take for instance, the file name is example.css and it is in the same directory as the current document, the following will be used.

href = "example.css"

<em>However, if example.css is in a different directory, the link to the file directory will be stated.</em>

<em></em>

Conclusively, one syntax to use for a file named example.css is:

<em><link rel = "stylesheet" type = "text/css" href = "exampl.css"></em>

5 0
3 years ago
You must install JMP pro on your computer before attempting this assignment. You must use the data file: MedicalMalpractice.JMP.
Arte-miy333 [17]

Answer:

Mean = 91044.915

Median = 22750

Explanation:

See exhibit 1 in attachment for explanation.

6 0
3 years ago
Write a static method called bothStart that allows the user to input two Strings and returns the String that is the longest subs
marishachu [46]

Answer:

  1.    public static String bothStart(String text1, String text2){
  2.        String s = "";
  3.        if(text1.length() > text2.length()) {
  4.            for (int i = 0; i < text2.length(); i++) {
  5.                if (text1.charAt(i) == text2.charAt(i)) {
  6.                    s += text1.charAt(i);
  7.                }else{
  8.                    break;
  9.                }
  10.            }
  11.            return s;
  12.        }else{
  13.            for (int i = 0; i < text1.length(); i++) {
  14.                if (text1.charAt(i) == text2.charAt(i)) {
  15.                    s += text1.charAt(i);
  16.                }else{
  17.                    break;
  18.                }
  19.            }
  20.            return s;
  21.        }
  22.    }

Explanation:

Let's start with creating a static method <em>bothStart()</em> with two String type parameters, <em>text1 </em>&<em> text2</em> (Line 1).  

<em />

Create a String type variable, <em>s,</em> which will hold the value of the longest substring that both inputs start with the same character (Line 2).

There are two possible situation here: either <em>text1 </em>longer than<em> text2 </em>or vice versa. Hence, we need to create if-else statements to handle these two position conditions (Line 4 & Line 13).

If the length of<em> text1</em> is longer than <em>text2</em>, the for-loop should only traverse both of strings up to the length of the <em>text2 </em>(Line 5). Within the for-loop, we can use<em> charAt()</em> method to extract individual character from the<em> text1</em> & <em>text2 </em>and compare with each other (Line 15). If they are matched, the character should be joined with the string s (Line 16). If not, break the loop.

The program logic from (Line 14 - 20) is similar to the code segment above (Line 4 -12) except for-loop traverse up to the length of <em>text1 .</em>

<em />

At the end, return the s as output (Line 21).

5 0
3 years ago
Why the HTML structure is important to properly written in HTML document
ololo11 [35]

Answer:

A properly written HTML document will not only be readable to the user, but will also convey the structure of the document, the relationship of its content to each other, and allow the user to link to other pages and sites. HTML can do all of this because it's a markup language.

5 0
3 years ago
Read 2 more answers
Other questions:
  • A network TAP serves what purpose on a network?
    7·1 answer
  • Implement the function maxLoc(), which returns an iterator at the largest element in a list. template typename list::iterator ma
    14·1 answer
  • To illustrate a point in a Word document with a simple chart, what commands should you select?
    8·2 answers
  • Write a Java program that can compute the interest on the next monthly mortgage payment. The program reads the balance and the a
    12·1 answer
  • After clicking the Start button on your computer screen desktop, what option would you then select to examine system components
    6·2 answers
  • The parallax perspective says that objects that are close up appear to move __________ than far away objects.
    10·1 answer
  • B.
    12·1 answer
  • Fair use laws allow you to use other people’s copyrighted information in which of the following purposes? A: For profit Purposes
    6·2 answers
  • Body paragraphs in a report have a first-line indent of _____ inch. *
    9·1 answer
  • 1. The Bank manager is imposing a 10% interest rate on the new salary loan to every account in the BPI Family Bank. (ANSWER SHOU
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!