Question

QUESTION 26 Complete a main method that will accomplish the following steps. (You may assume that...

QUESTION 26

Complete a main method that will accomplish the following steps. (You may assume that the class includes all appropriate setter methods and getter methods for all instance variables.)

Create a 2015 Honda Accord.

Create a 2017 Ford Escape.

Change the year of the Honda Accord to 2013.

Print the make of the Escape.

QUESTION 27

Write a method that meets the requirements of the following comment.

// findLowestPrice
//
// the purpose of this method is to find the lowest price among 3 prices.
//
// Input Arguments: price1, price2, price3
//                  three prices, as double types
// Return Value:   minPrice
//                  the smallest price value

QUESTION 28

Write a method that meets the requirements of the following comment.

// printHigherBank
//
// The purpose of this method is to print the name of the bank that provides the
// larger rate. If both rates are the same, print the name of the first bank.
//
// Input Arguments: bankName1, rate1, bankName2, rate2
//                  the names two banks (as Strings)
//                  and the rates they offer (as doubles)
// Return Value:    none

QUESTION 29

Write a method named isMultiple that determines if the first integer is a multiple of the second integer. (Hint: An integer is a multiple of another integer if there is a remainder of 0 when the first integer is divided by the second). Return true if the first integer is a multiple of the second, or false if it is not.

QUESTION 30

Write a main method that uses the isMultiple method from question 29 to determine if one integer is a multiple of another integer. Prompt the user for two integers, then accept the two integers from the user. Print a message that states whether or not the first integer is a multiple of the second integer.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
public class CarsMain {

    public static void main(String[] args) {
        Car accord = new Car(2015, "Honda", "Accord");
        Car escape = new Car(2017, "Ford", "Escape");
        accord.setYear(2013);
        System.out.println(escape.getMake());
    }

}

\color{red}as\;per\;guidelines\;we\;are\;only\;allowed\;to\;answer\;first\;question\\ Please\;make\;separate\;posts\;for\;remaining\;questions\\ Thanks

Add a comment
Know the answer?
Add Answer to:
QUESTION 26 Complete a main method that will accomplish the following steps. (You may assume that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In this lab, you will create one class named ArrayFun.java which will contain a main method...

    In this lab, you will create one class named ArrayFun.java which will contain a main method and 4 static methods that will be called from the main method. The process for your main method will be as follows: Declare and create a Scanner object to read from the keyboard Declare and create an array that will hold up to 100 integers Declare a variable to keep track of the number of integers currently in the array Call the fillArray method...

  • Part 3 (Lab2a) In this exercise you will: a. Write a method called secondTime that takes...

    Part 3 (Lab2a) In this exercise you will: a. Write a method called secondTime that takes as argument an integer corresponding to a number of seconds, computes the exact time in hours, minutes and seconds, then prints the following message to the screen: <inputseconds> seconds corresponds to: <hour> hours, <minute> minutes and <second> seconds Write another method called in Seconds that takes as arguments three integers: hours, minutes and seconds, computes the exact time in seconds, then returns the total...

  • Write a complete Java program called MethodTest according to the following guidelines. The main method hard-codes...

    Write a complete Java program called MethodTest according to the following guidelines. The main method hard-codes three integer values into the first three positions of an array of integers calls a method you write called doubleEachValue that takes an array of integers (the one whose values you hard-coded in main) as its only argument and returns an ArrayList of integers, with each value in returned ArrayList equal to double the correspondingly indexed value in the array that is passed in...

  • Write a complete Java program, including comments in both the main program and in each method,...

    Write a complete Java program, including comments in both the main program and in each method, which will do the following: 0. The main program starts by calling a method named introduction which prints out a description of what the program will do. This method is called just once.      This method is not sent any parameters, and it does not return a value. The method should print your name. Then it prints several lines of output explaining what the...

  • Write a python program (recursive.py) that contains a main() function. The main() should test the following...

    Write a python program (recursive.py) that contains a main() function. The main() should test the following functions by calling each one with several different values. Here are the functions: 1) rprint - Recursive Printing: Design a recursive function that accepts an integer argument, n, and prints the numbers 1 up through n. 2) rmult - Recursive Multiplication: Design a recursive function that accepts two arguments into the parameters x and y. The function should return the value of x times...

  • Problem 14: all 5 parts must be complete to receive credit for the question    /**...

    Problem 14: all 5 parts must be complete to receive credit for the question    /** * q1: Write a public static method named q1 that takes no parameters and returns void. The * method should print all the integers from -8 to 47 to the screen. The output should be * inclusive of these end points */             /** * q2: Write a public static method named q2 that takes two ints as parameters and returns...

  • DESCRIPTION: The purpose of this question is offload processing from the main method to a static...

    DESCRIPTION: The purpose of this question is offload processing from the main method to a static helper method. You will be given the main method. Do not alter this code. Your goal is to write a new method called oddOneOut, which will accept a String, and print it in out every other letter. For example, if the String was "abcdefghijk", the oddOneOut method will return "acegik" . METHOD INPUT: A string METHOD PROCESSING: Do not alter the  main method. Complete the...

  • ****WRITE A JAVA PROGRAM THAT : Write a method named stretch that accepts an array of...

    ****WRITE A JAVA PROGRAM THAT : Write a method named stretch that accepts an array of integers (that the user inputs) as a parameter and returns a new array twice as large as the original, replacing every integer from the original array with a pair of integers, each half the original. If a number in the original array is odd, then the first number in the new pair should be one higher than the second so that the sum equals...

  • java estion7 For this question, assume all input comes from the keyboard, and al output goes...

    java estion7 For this question, assume all input comes from the keyboard, and al output goes to the screen. Include method prototypes and comments. The array should have room for 100 integers Write a complete Java program, including at least one comment in the main propram and one in e to do the following: Write a main program which will call the methods described below (a) First the main program will read an integer (this integer is a parameter or...

  • This is to be written in C++. Thank you so much for you help as I'm...

    This is to be written in C++. Thank you so much for you help as I'm really struggling with this. Must be written in this format: #include <stdio.h> int main(void) { printf("Hello World\n"); return 0; } The explosive growth of Internet communications and data storage on Internet-connected computers has greatly increased privacy concerns. The field of cryptography is concerned with coding data to make it difficult (and hopefully—with the most advanced schemes—impossible) for unauthorized users to read. In this exercise,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT