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
NemiM [27]
3 years ago
10

Java Eclipse homework. I need help coding this|

Computers and Technology
1 answer:
mezya [45]3 years ago
5 0

import java.util.Scanner;

import java.util.Arrays;

public class MyFamily {

   public static void main(String[] args) {

       float avg = 0;

       int smallest = 0;

       int largest = 0;

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter the name of a friend or family member.");

       String name1 = scan.nextLine();

       System.out.println("Enter "+name1+"'s age");

       int name1Age = scan.nextInt();

       System.out.println("Enter the name of a friend or family member.");

       String name2 = scan.next();

       System.out.println("Enter "+name2+"'s age");

       int name2Age = scan.nextInt();

       System.out.println("Enter the name of a friend or family member.");

       String name3 = scan.next();

       System.out.println("Enter "+name3+"'s age");

       int name3Age = scan.nextInt();

       int[] ages = {name1Age, name2Age, name3Age};

       Arrays.sort(ages);

       System.out.println("The oldest is " + ages[2] + " years old");

       System.out.println("The youngest is " + ages[0] + " years old");

       System.out.println("The average is (("+name1Age + "+" + name2Age + "+" + name3Age+") / 3) = " + ((name1Age + name2Age + name3Age) / 3) + " years old");

       System.out.println(name1+", "+name1Age + " years old");

       System.out.println(name2+", "+name2Age + " years old");

       System.out.println(name3+", "+name3Age + " years old");

       

   }

   

}

I hope this helps!

You might be interested in
What does it mean if my ninja blender power light is blinking?
Dafna11 [192]
It will only blink if the Ninja Blender's top isn't on all the way.
7 0
3 years ago
Read 2 more answers
To keep a desktop computer or a server powered up when the electricity goes off in addition to protection against power fluctuat
pickupchik [31]

To keep a desktop computer or a server powered up when the electricity goes off in addition to protection against power fluctuations, an <u>uninterruptible power supply (UPS)</u>, which contains a built-in battery, can be used.

<u>Explanation</u>:

An uninterruptible power supply (UPS) is a device that allows a computer or server powered up for a short time, when the electricity goes off. UPS device also provides uninterrupted service during power fluctuation.

A battery is inbuilt in the UPS and provides power for few minutes to the computer to shut down it in a proper manner.

UPS is available at affordable cost and can be maintained at low cost compared to generators.

8 0
2 years ago
Read 2 more answers
A car holds 16 gallons of gasoline and can travel 312 miles before refueling. Write aC++ program that calculates the number of m
IgorC [24]

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables Declaration and initialization

   int no_gallon=16;

   int dis=312;

   // find the miles per gallon

   double mile_gallon=dis/double(no_gallon);

   // print the results

   cout<<"number of gallons: "<<no_gallon<<endl;

   cout<<"distance travel before refueling: "<<dis<<endl;

   cout<<"miles per gallon is: "<<mile_gallon<<endl;

return 0;

}

Explanation:

Declare and initialize the number of gallon and distance travel without refueling. Calculate the miles per gallon by dividing distance with number of gallons.Then print the results.

Output:

number of gallons: 16

distance travel before refueling: 312

miles per gallon is: 19.5

6 0
3 years ago
1. It is acceptable to use a jack that has been
krok68 [10]
D. None of the above
7 0
2 years ago
design a relational database in EER for bike helmets and their reviews. a bike helmet has a name and color attributes. a bike co
Law Incorporation [45]

Answer:something you gotta do on your own

Explanation:

7 0
3 years ago
Other questions:
  • How can you differentiate between standard and protocol? Write at least on example of each of these terminologies?
    12·1 answer
  • What does the int size = sizeof buffer / sizeof * buffer means ?
    7·1 answer
  • The while loop is a pre-test loop? TRUE OR FALSE
    9·2 answers
  • What component of Kerberos is responsible for storing keys for encrypting and decrypting data in the authentication process?
    13·1 answer
  • The clear emergence of a leader and the development of group norms and cohesiveness are the key indicators of the ________ stage
    6·1 answer
  • What is the difference between a software engineer and a system analyst?
    8·1 answer
  • In addition to paying $100 per month for health insurance, sam is responsible for paying her first $500 of medical bills every y
    10·1 answer
  • 4.5 code practice computer science
    5·1 answer
  • Here’s my last question
    12·2 answers
  • 8. The cell reference for a range of cells that starts in cell A1 and goes over to column G and down to row 10 is, a. A1-G10 b.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!