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
Using evidence to dispel myths or false beliefs is one way to move closer to evidence-based practice. Please select the best ans
Marrrta [24]
The correct answer is TRUE
7 0
2 years ago
Read 2 more answers
The new Director of Information Technology has asked you to recommend a strategy to upgrade the servers on their network. Recomm
borishaifa [10]

Answer:

servers to be upgraded are : APPLICATION AND LOAD BALANCING SERVERS

servers still appropriate to use : DNS AND DHCP SERVERS

Explanation:

The recommendations to be made in line with what the new director of information is asking for includes :

1 ) For the servers to be upgraded : The servers that requires upgrades  includes the APPLICATION SERVER and LOAD BALANCING SERVER. this is because these two servers are critical to the growth/expansion of any business, and they handle large volume of data

Recommendations on the servers upgrade includes:

Hardware : 2.3 GHz Intel Xeon Gold 5118 12-Core

CPU chip set :  Socket: FCLGA3647, Type: NSBM

Speed : processor 3.2 GHz

caching:   > 100 Gb

2)  For servers that do not necessarily need to be upgraded : The servers that do not need immediate upgrade are DNS and DHCP

6 0
2 years ago
What does the binary odometer show about representing large numbers​
Gelneren [198K]

Answer and Explanation:

The binary odometer represents the large number to judge that what happened when there is a large number that gets too large

Here we visit the level 2 of the binary odometer widget in the chapter of Code studio

This represents a widget that reproduced an odometer of a car in which the tracking of a device could be known that how much far the car is driven with respect to the miles or kilometers

7 0
2 years ago
In the graph shown here, by what percentage are the number of people in computer occupations in general projected to increase?
SOVA2 [1]

Answer:

12% or 21%

Explanation:

not really sure

8 0
2 years ago
Read 2 more answers
Give a recursive (or non-recursive) algorithm to compute the product of two positive integers, m and n, using only addition and
LiRa [457]

Answer:

Multiply(m,n)

1. Initialize product=0.

2. for i=1 to n

3.      product = product +m.

4. Output product.

Explanation:

Here we take the variable "product" to store the result m×n. And in this algorithm we find m×n by adding m, n times.

6 0
2 years ago
Other questions:
  • An organization has a datacenter manned 24 hours a day that processes highly sensitive information. The datacenter includes emai
    5·1 answer
  • FTP requires confirmation that a file was successfully transmitted to a client, but it has no built-in mechanism to track this i
    5·1 answer
  • Database management systems are expected to handle binary relationships but not unary and ternary relationships.'
    7·1 answer
  • Using the RAID controller on the motherboard, you configure three hard disks in a RAID 5 array. You leave the array unpartitione
    14·1 answer
  • Write a while loop that prints usernum divided by 2 until user_num is less than 1. The value of user_num changes inside of the l
    14·1 answer
  • 63:47 One side in a Transmission Control Protocol (TCP) connection has not been able to properly recover from a series of malfor
    15·1 answer
  • Now that the classList Array has been implemented, we need to create methods to access the list items.
    5·1 answer
  • Three variables , x, y and z, supposedly hold strings of digits, suitable for converting to integers. Write code that converts t
    9·2 answers
  • Which option in the Caption dialog box configures whether the caption appears above or below the image
    11·2 answers
  • Spark is electrical discharge in air, while air is mix of variety of gases what particles conduct electricity in gas
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!