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
astra-53 [7]
3 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]3 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 flashlight many parts work together as a system. which of the following parts is considered the output in this particular s
kap26 [50]
C. The light bulb
Light is not a part of the flashlight and everything is working together to output light from the bulb
7 0
3 years ago
Read 2 more answers
Jessie will make and sell the trending Baked California Maki. Her Peso mark up is 5.00. Selling price PHP 15.000. How much will
Levart [38]

Answer:

50%

Explanation:

The markup is the difference between the selling price and the cost price. If the mark up is greater than zero, it means there is a profit, if the markup is less than 0, it means there is a loss and if the markup is equal to 0, it means there is breakeven.

Percentage markup = (markup/cost price) * 100%

Selling price - cost price = markup

15 - cost price = 5

cost price = 10

Percentage markup = (markup/cost price) * 100% = (5/10) * 100% = 50%

7 0
3 years ago
Explain in your own words why main memory is constrained in a mobile device
iren [92.7K]

Answer:

because it stores the data and downloads and prevent overheating  

Explanation:

3 0
3 years ago
Why does the font­family css specification take a list rather than a single font name?
azamat
You can't guarantee that the computer displaying the page has all the fonts that you want. Generally for font-family (note the hyphen!) you list:

the font you REALLY want
a font that's similar and more common (you HOPE it has)
the family (like serif or san-serif)
5 0
4 years ago
Cathy designed a website for a cereal brand. When users view the website, their eyes first fall on the brand name, then they vie
katrin2010 [14]

Hey there!

I would say the answer to this question is <u>Movement</u>.

If you look at the principles of design the definition of Movement is <u>Movement is the path the viewer's eye takes through the work of art, often to focal areas.</u>

In Cathy's design, it states that when viewers view her website their eyes first fall on the brand name, and then they view the bright images on the page.

Based on the information given you can conclude that the design principle that Cathy used was <u>Movement</u>.

I hope this helps,

Have a great day!

<u></u>

4 0
3 years ago
Other questions:
  • Data silos are often associated with ________________.
    12·1 answer
  • Someone who participates online for social reasons usually has a:
    9·1 answer
  • What is not soured of income
    6·1 answer
  • What should be the very last function performed in the lab before you leave? Bid the instructor farewell wipe your hands on a to
    11·1 answer
  • You are creating a mobile version of a community discussion site for busy moms. Users post questions and other topics for discus
    10·1 answer
  • Turns on her laptop and gets the error message "OS NOT FOUND." She checks the hard disk for damage or loose cable, but that is n
    11·1 answer
  • Differentiate between Computer Science and Information Technology
    10·1 answer
  • Diane changes the size of an image with the format picture pane and keeps the original ratio of height to width of the object. W
    8·1 answer
  • For angular how can we set up th edatabse.
    11·1 answer
  • What is control structure write it's types​ .
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!