getName returns the road name (string). getDistance retuns road distance (amy hype).
Q: What does the IndexOf method return when the string does not contain the subString?
A: IndexOf method The IndexOf method is used to find the index of a substring or some specified…
Q: . Download the program from the instructor’s GitHub account (Ch3HW) then update it to create a class…
A: import java.util.ArrayList;import java.util.HashMap;import java.util.List;import…
Q: 5. (Longest common prefix) Write a method that returns the longest common prefix of two strings. For…
A: FUNCTION: def prefix(str1, str2): n1 = len(str1) n2 = len(str2) result = ""…
Q: Tableau shows you are importing a geographical variable by showing the __________ icon
A: Tableau shows you are importing a geographical variable by showing the __________ icon. Multiple…
Q: Add a while loop to the Imperial BMI procedure below. def BMIImperial(height, weight, bmiList,…
A: First Step is declare bmiList and Category list and pass height, weight, bmiList and Category in the…
Q: URLManager() Children Parent Category: char CheckURL(): char SaveURL() SetURLCategory() +…
A: Hey there, I am writing the required solution of the questin mentioned above. Please do find the…
Q: University College -name:string -address:string -website:string -tel:int -email:string 1.…
A: To do: for given
Q: • Returns False if two Food objects do not have all the same attributes • This method should not…
A: Python used to answer this question
Q: Word Counter Create an application with a method that accepts a string as an argument and returns…
A: Program plan: Include the necessary header files . create a class called WordCounter use Scanner()…
Q: m Book Author -name:String -authors:Author[] -price:double -qty:int = 0 -name:String -email:String…
A: We need to define the classes Author and Book as per the given description.
Q: Bank object, then test the methoc Account accountNumber : int - accountName : String
A: Code:- class Account{ private int accountNumber; private String accountName; private double…
Q: Given a string, create a new string with all the consecutive duplicates removed. #assign the result…
A: Answer:
Q: QUESTION3. The program will ask the user to enter the width and length of a rectangle, and then…
A: Given:
Q: Person - id: int - fName : String - LastName: String - phoneNum : String + getld() : int + getfName(…
A: Person.java
Q: Randomly generate a number in range [1, 12]. Map this number to a season: if the number is 3, 4, or…
A: Programming Language => PYTHON I have provided PYTHON CODE along with CODE SCREENSHOT…
Q: QUESTION3. The program will ask the user to enter the width and length of a rectangle, and then…
A: import java swing j option pane Create a class Rectangle with tow integer variable width and length…
Q: 9. Chess Board Write a program that draws an 8 X 8 chess board, with alternating gray and white…
A: As per guidelines we can answer only one question for answer of other question please ask separately
Q: For the .selectedIndexChanged procedure of a checkboxlist to work you must А. Make the procedure…
A: for the .selectedIndexChanged procedure of a checkboxlist to work you must
Q: Write an Add method that adds the contents of the decPrice variable to the lstPrices control.
A: Add method The add method is used to add a specific element. The function is used to add the…
Q: Write a statement that removes the items from the lstPrices control.
A: “ListBox”cControl has a property called “Items”, which represents the collection of items in the…
Q: Aquarium Fish - length: double - width: double - height: double fishes: Fish [ ] - name: String -…
A: If you want to run the code you can run it on online GDB compiler. I have bolded out the code for…
Q: ComputeBMI.py, to let users enter their weight in pounds and their height in feet and inches. For…
A: PROGRAM CODE: # Prompt the user to enter weight in poundsweight = eval(input("Enter weight in…
Q: > > > - Name # id - phoneNo ( String ) 10 digits - companyName (String) (String) (int) getTax () ;…
A: Constructor is a block of code that is used to create an instance of class. It has the same name as…
Q: a. The mean of a list of numbers is its arithmetic average. The median of a list is its middle value…
A: Mean or arithmetic average: The mean of n- values is to sum of all the n -values and divide the sum…
Q: > Shape -color:String +Shape() +getColor ():String +setColor (color:String):void +getArea():double…
A: An abstract class is a class that is declared abstract and can have abstract or non-abstract…
Q: Factorial :: Integer –> Integer actorial n = if n > 0 then n * factorial (n-1) else 1 cosTaylor…
A: TODO command is used to solve the cultural ambiguity of error but will also throw a compile time…
Q: add a code at the "Search a book" where i can search for a book and if the word matches the book it…
A: ALGORITHM:- 1. Declare and initialise an arrayList object for Book Titles. 2. Take input for the…
Q: Person - id: int - fName : String - LastName: String - phoneNum : String + getId() : int + getfName(…
A: In the given picture class diagram is given, with class name : Person datamembers of class Person :…
Q: the program that will allow user searc should see the list of items currently a should see the…
A: Language: C++/ CPP Complete Source Code with proper indentation and line by line comments has been…
Q: Regular > - category: string Product + Regular(string, double, string) + displayDetails(): void +…
A: Answer: Our instruction is answer the first three part from the first part and . I have done code in…
Q: Regular > |- category: string Product # name: string # price: double + Regular(string, double,…
A: Name.h: #ifndef NAME_H_INCLUDED #define NAME_H_INCLUDED #include <iostream> #include…
Q: Q1 - Assuming that a Map collection is called "courseMap". It holds records of courseNo and…
A: As per our guidelines, we are supposed to answer only one question. Kindly repost other questions as…
Q: Add the definitions of the setBoxDimensions function to set the dimensions of the box and getVolume…
A: ALGORITHM:- 1. Create a class Box and declare 3 private variables in it for holding the values of…
Q: START OF PLAY The player starts with 100 points. They have ten attempts (or rounds) to reach 500…
A: Answer: Python Source Code: import randomprint("--- Welcome to High-Low ---")print("Start with 100…
Q: STATUS 12345 NOT SUBMITTED import simplegui 3- def draw_handler (canvas): # your code goes here…
A: I have written the code below for following question:
Q: Challenge Problem: What will be stored in number at the end of the code?
A: Here, number, number2 and number3 are variables and let's see how they changes after executing step…
Q: START OF PLAY The player starts with 100 points. They have ten attempts (or rounds) to reach 500…
A:
Q: The mean of a list of numbers is its arithmetic average. The median of a list is its middle value…
A: Start enter 9 number by defining median `calculate median calculate mean and print it
Q: Toyota -model: String -color: String -MPG: int +vin: int +start: boolean +Toyota(vin:int, int:mpg)…
A: The code for the above-given question is given below:
Q: please complete this method /** * Checks whether an item is inside the set. * @param item to be…
A: Java is a high-level programming language that supports Object-Oriented Programming. Java is used as…
Q: Which method displays a plot? (A) plt.display() (B) plt.plot() plt.disp() (D) plt.show()
A: B is the answer.
Q: Declare a MyStruct variable that initializes the first field to zero
A: Declaring a variable: A structure variable names a type and specifies a sequence of variable values…
Q: //6. addButtonListeners //a. Selects all buttons nested inside the main element //b. If buttons…
A: Given: //6. addButtonListeners //a. Selects all buttons nested inside the main element //b. If…
Q: Instructions: 1. This java program is for an application that stores the author (Writer) data of…
A: Instructions: 1. This java program is for an application that stores the author (Writer) data of…
Q: ProductParser Product #productid String="?" #quantity int=0 #unitPrice:double=0.0…
A: Java used to answer this question
Q: Using begin() and end() lets you access all the elements in the View. Make it more flexible by…
A: Code:void f(vector<string>& v){ string val; cin >> val; // ... int index…
Q: • getLength ()–This method should ask the user to enter the rectangle's length, and then return that…
A: The required Java code is: import java.util.Scanner;public class rectangle { double length;…
Q: True or False The assignment operator assigns the value that appears on its left side to the item…
A: Assignment operator The equal sign is known as an assignment operator. It assigns the value that…
Q: CHALLENGE 1.15.2: Name song. ACTIVITY Modify songVerse to play "The Name Game" (Oxford…
A: Code in java: public static void main(String[] args) { Scanner scnr = new…
Q: The mean of a list of numbers is its arithmetic average. The median of a list is its middle value…
A: In the above code, it has been asked to print the mean and median of the 9 numbers, in the following…
java
Step by step
Solved in 2 steps
- Write a class called Pokemon that has a name (e.g. “Pikachu”) and a number (e.g. 25). Implement a constructor that takes both values as parameters. Implement accessors for both values. Implement a toString() that returns a string in the format “Name(number)”, e.g. “Pikachu(25)”. Implement an equals(Object) method (two Pokémon are considered equal if they have the same number). Implement a hashCode() method that returns the number.(remember the equals and hashCode contract).Write a Java program that prompts a user for vehicle data and stores it in a linked list, and then sorts the list in ascending order based on miles-per-gallon and writes the sorted data to a text file, you can follow these steps: Create a class named Vehicle with private fields: make (String), model (String), and milesPerGallon (double). Include getters and setters for these fields. Implement the Comparable interface for Vehicle class and override the compareTo() method to compare vehicles based on their milesPerGallon. Create a main class (for example, VehicleDriver.java) to handle user input and perform the necessary operations. Inside the main method, create a BufferedReader object for user input. Prompt the user to enter the number of vehicle data they want to enter and store it in a variable (for example, nVehicles). Use a loop to iterate nVehicles times and prompt the user to enter make, model, and miles per gallon for each vehicle. Create Vehicle objects using the input data…Review: 4. What is the output of below javacode? ___________import java.util.*;class Array{public static void main(String args[]){int array[] = new int [5];for (int i = 5; i > 0; i--)array[5-i] = i;Arrays.fill(array, 1, 4, 8);for (int i = 0; i < 5 ; i++)System.out.print(array[i]);}} 5. Complete the sentence: The type parameter section is surrounded by ________.6. A method that introduces its own type parameter is a generic method. True/False.7. Complete the sentence: Generic type parameters can be restricted to a group of types that implement a given interface. You can do that byusing the keyword__________.8. Type parameters can represent ( stand for) reference types as well as primitive types. True/false.
- Implement a class called ShoppingCart that implements the BagInterfaceMyType in Java. Your implementation should include the following: Fields: MyType[] myBag; int numberofProducts; Default_Capacity; Methods: Constructor(): initialize bag add() - will be used to add a new entry. toArray() - provides an array of the allocated bag. isFull() - test whether the bag is at the maximum capacity. Implement a BagDemo that tests your bag implementation class. Methods: testAddl() - will add the contents to the Bag. displayBag() - will display the contents of the Bag. Please and Thank youWrite a JAVA program that implements the NumberFormatter interface. public interface NumberFormatter { String format(int n); } Include three classes that implement this interface. The DefaultFormatter class formats an integer in the usual way. The DecimalFormatter formats an integer with decimal separators (a comma). The AccountingFormatter formats negative values by surrounding the value with parentheses (not a minus sign). The main method should instantiate an instance of each of the formatters and use it to format a large value (e.g., 2 million), a negative value (e.g., minus 1365), and a small positive integer (e.g., 256). The results should be right aligned and look like the example below. For example, using the above values, the DefaultFormatter would result in: 2000000 -1365 256 The DecimalFormatter would result in: 2,000,000 -1,365 256 The AccountingFormatter would result in: 2000000 (1365) 256Write a java program that Create a generic class AnimalList that has a type parameter T. It should have at least two properties declared as the passed type, constructors), getters, setters, and toString methods. Create a superclass Animal that has two properties (String, int, etc.), and constructor, getters, setters, and toString methods. Create two subclasses of Animal called Cat and Dog. Each class should have a unique property and method. Create a class Lizard with a method of your choice. Create a main class AnimalTest that creates two instances of Animal: Dog type and Cat type. Create a method that takes Animal type as parameter constraining the types to be subclasses of the Animal class only; check the type of object and call the unique method in the Dog and Cat. Create an instance of the Lizard class and test it. Display all objects.
- Can someone complete this implementation of interface class in JAVA public class Main{ public static void main(String[] args) { Shape s = new Square(2); Shape r = new Rectangle(4,2); Shape t = new Triangle(3,3); // Your test code here }} -------- public interface Shape{ public float Area(); public float Perimeter(); public String Shapetype();} ------ public class Rectangle implements Shape{ } ------------ public class Square implements Shape{ } ----------- public class Triangle implements Shape{ } ------------Implement a class named Parade using an ArrayList, which will manage instances of class Clown. Each Clown only needs to be identified by a String for their name. Always join a new Clown to the end of the Parade. Only the Clown at the head of the Parade (i.e., the first one) can leave the Parade. In addition, also write a method called isFront that takes a Clown as parameter and returns true if the passed clown is at the front of the parade otherwise returns false. Create a test application to demonstrate building a parade of three or four clowns and include your own name. Then, remove one or two, and add another one or two. Also, test the isFront method by passing different clowns to the method.Implement the Comparable interface in the Laptop class. When you implement the compareTo() method from the Comparable interface you must use at least two instance variables in the comparison. Once you have implemented the Comparable interface, in the main method: • Add the following comment - // Part 5 - Generic methods • Write the code to sort the Arraylist that you created in Part 4 . • Add the following code - System.out.println("------------------------------");
- Write a program in the Java language that includes: 1. A class for books, taking into account the encapsulation and getter, setter. 2. Entering books by the user using Scanner 3. LinkedList class for: (Adding a new book - Inserting a book- Searching for a book using the ISBN Number - Viewing all books,delete book). 4. Serial number increases automatically with each book that is entered. 5. Printing the names of books is as follows: Serial - ISBN - Name - PubYear - Price - Notes. 6-Design a main menu that includes: • Add Book • Insert Book • Delete Book • Search . Display . ExitWrite a Java class called MostOftenOccurring. This class defines a method called occursMostOften(), which takes as its only parameter an array of int called a and returns an int representing the value which occurs most often in a. If there is a tie, display the value which occurs first in a among those that occur most often. Repeat the operation often.Given a class Square with an instance variable width, provide a recursive getArea method. Construct a square whose width is one less than the original and call its getArea method. Make a resource class that contains all of the methods and make a driver class in a separate file, and the driver class only needs to call those methods. The driver class needs to have only 5 lines of code. The code will need to be written in Java. Please help me with exactly what I asked for help