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
astra-53 [7]
2 years ago
11

This class has one instance variable, a double called miles. The class has methods that convert the miles into different units.I

t should have the following methods:public Distance(double startMiles) - the constructor; initializes milespublic double toKilometers() - converts the miles to kilometers. To convert to kilometers, divide miles by 0.62137public double toYards() - converts miles to yards. To convert to yards, multiply miles by 1760.public double toFeet() - converts miles to feet. To convert to feet, multiply miles by 5280.public double getMiles() - returns the value of milesMain MethodTo test your class, create three Distance objects in main. One represents the distance between Karel and school, Karel and the park, and Karel and his best friend.Karel lives 5 miles from school. Karel lives 10 miles from the park. Karel lives 12 miles from his best friend.Your program should use the methods from Distance to print the number of:1. yards Karel lives from school2. kilometers Karel lives from the park3. feet Karel lives from his best friend
Computers and Technology
1 answer:
OverLord2011 [107]2 years ago
5 0

Answer:

The class definition with the instance variable and all the required methods is given below:

<em>public class Distance{</em>

<em>    double miles;</em>

<em>    public Distance (double startMiles) {</em>

<em>        this.miles = startMiles;</em>

<em>    }</em>

<em>    public double toKilometers ( ){</em>

<em>          double kilometerValue = miles/0.62137;</em>

<em>          return kilometerValue;</em>

<em>        }</em>

<em>    public double toYards(){</em>

<em>        double yardsValue = miles*1760;</em>

<em>        return yardsValue;</em>

<em>        }</em>

<em>    public double toFeet(){</em>

<em>        double feetsValue = miles*5280;</em>

<em>        return feetsValue;</em>

<em>        }</em>

<em>    public double getMiles(){</em>

<em>        return miles;</em>

<em>        }</em>

<em>}</em>

The main method to test the class is given in the explanation section

Explanation:

<em>public class Main {</em>

<em>    public static void main(String[] args) {</em>

<em>        Distance karelToSchool = new Distance(5.0);</em>

<em>        Distance karelToPark = new Distance(10.0);</em>

<em>        Distance karelToFriend = new Distance (12.0);</em>

<em />

<em>        double karel_Yards_From_School = karelToSchool.toYards();</em>

<em>        System.out.println("Karel's Yards from School is "+karel_Yards_From_School);</em>

<em />

<em>        double karel_kilometers_from_park = karelToPark.toKilometers();</em>

<em>        System.out.println("Karel's Kilometers from Park is "+karel_kilometers_from_park);</em>

<em />

<em>        double karel_feets_from_friend = karelToFriend.toFeet();</em>

<em>        System.out.println("Karel's Feets from Friend is "+karel_feets_from_friend);</em>

<em>    }</em>

<em />

<em>}</em>

You might be interested in
in a small office, there are 5 computers, a network printer, and a broadband connection to the internet. what devices are needed
Nataly [62]

Answer:

<em>Ethernet cables, Network Adapters, Modem, Routers, Switches.</em>

Explanation:

<em>The devices that are required in setting up a wired network for the 5 computer comprises of the following devices </em>

  • <em>Ethernet Cables</em>
  • <em>Network Adapters</em>
  • <em>Modem/Router</em>
  • <em>Network Switch</em>

<em>Ethernet cables: They are called network cables or RJ-45 cables used to in connecting two or more computers together. it has different categories called, the untwisted pair and twisted pair Ethernet, with a speed from 10-1000</em>

<em>Network Adapters : This adapters allows a computer device to connect and interface with a network computer</em>

<em>Modem/Routers : A router is a device that that sits in the  middle  between your local computers and modems. it takes receives information or gets information from the modem and delivers it to the computer</em>

<em>Network switch: it connects more than two computers together to a network and share data among themselves and other devices on the network</em>

6 0
2 years ago
Justify the statement "The same job title can have different job roles and different qualification criteria in different organiz
Lana71 [14]

Answer:

Below is an executive summary of this particular issue.

Explanation:

  • Each organization has differential requirements and preferences. This same employment opportunities rely heavily on either the structure of the company and indeed the amount of equipment that it possesses.
  • Hence, whenever they recruit an individual on a specific job, their work description can differ based on the organization's needs including growth.
4 0
2 years ago
Frank works for an organization that wishes to install a software program on a single server with multiple users connected. Whic
Helen [10]
The best answer to this question should be (A) Cloud Computing.

In general, cloud computing is the term used for the delivery of hosted services over the internet. We can also simply put cloud computing as the delivery of computing services like storage, servers, databases, software and more over the internet.




7 0
2 years ago
A student made a model of isostasy by placing a block of wood in a beaker of water. What does the wooden block represent in the
Komok [63]
I am almost positive the answer is B, Earth's crust. I know it cannot be A or C because isostasy has nothing to do with sea level or glaciers, and Earth's mantle is inside.
7 0
2 years ago
Read 2 more answers
A patient asks her doctor to send a copy of her records to another medical office. However, the records are not transmitted beca
bezimeni [28]
 This type of security failure is called WIN32K_SECURITY_FAILURE. <span> This indicates a </span>security failure was detected in win32k. <span>According to a new report issued by Dark Reading, there are a number of key </span>security failures<span> that cybercriminals take advantage of.</span>
5 0
2 years ago
Read 2 more answers
Other questions:
  • Of the following tasks, which one CANNOT be easily accomplished with a Wiki? Collaborating Social networking Editing Reading
    13·1 answer
  • When you examine a computer chip under a microscope, what will you see?
    6·1 answer
  • Graphical elements that precede each item in a list are known as​ __________.
    8·1 answer
  • Jason is working on a web page that includes Q&amp;A interactions. Which option should Jason select to engage users in the inter
    9·2 answers
  • This program finds the sum and average of three numbers. What are the proper codes for Lines a and b?
    6·2 answers
  • Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two processing
    11·1 answer
  • Within a word processing program, predesigned files that have layout and some page elements already completed are called text bo
    15·1 answer
  • Write a loop that continually asks the user what pets the user has, until the user enters "rock", in which case the loop ends. I
    12·1 answer
  • Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is:teamWins / (teamWin
    15·1 answer
  • Complete the program below that takes in one positive, odd, integer, n (at least 3), and prints a "diamond" shape of stars with
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!