Can some please help me to answer these two questions. Write a program in Java
abstract class User { abstract boolean authenticate(String a, String b); } interface Printable { void print(); } class Administrator extends User implements Printable { boolean authenticate(String a, String b) { return a != null && b != null; } public void print() { System.out.println(this.toString()); } }
Can some please help me to answer these two questions. Write a program in Java create...
Please help me to solve this problem with java language! write a program that runs a thread which prints a timestamp and then waits a second by doing the following: 1. Implement a class that implements the Runnable interface. (1 point) 2. Place the code for your task into the run method of your class. (6 points) a) To get the date and time, construct a Date object. b) To wait a second, use the sleep method of the Thread...
Can someone please help with this in JAVA? Write one application program by using the following requirements: 1) Exception handling 2) Inheritance a) At least one superclass or abstract superclass: this class needs to have data members, accessor, mutator, and toString methods b) At least one subclass: this class also needs to have data members, accessor, mutator, and toString methods c) At least one interface: this interface needs to have at least two abstract methods d) At least one method...
ISu a The paradox d I ata fields (or mputers. Program 3 Assume the existence of a class called Voter which defines two instance variables: Add 10 user to the ArrayList. private String name; rivate char party: 'D'for Democrat or 'R' for Republican Assume that this class implements these two methods: public char getParty() public String tostring) // name and party affiliation Now assume you're in the main method in another class called VoterDriver. Write a Java statement that instantiates...
Answer the following: 1. Create a Class Car with the following instance variables: model (String), Brand (String), maxspeed (double) Note: use encapsulation (all variables are private). (3 Marks) 2. Create a non-default constructor for Class Car which takes 3 parameters. (2 Marks) 3. Create a get and set methods for instance variable model variable only. (2 Marks) 4. Create PrintInfo() method which prints all three instance variables. (2 Marks) 5. Create a subclass GasCar with instance variable TankSize (double).. (2...
Write ONE application program by using the following requirements: Using JAVA File input and output Exception handling Inheritance At least one superclass or abstract superclass: this class needs to have data members, accessor, mutator, and toString methods At least one subclass: this class also needs to have data members, accessor, mutator, and toString methods At least one interface: this interface needs to have at least two abstract methods At least one method overloading At least one method overriding At least...
JAVA Problem: Coffee Design and implement a program that manages coffees. First, implement an abstract class named Coffee. The Coffee class has three member variables: coffee type, price, and store name. The Coffee class has an abstract method name ingredient. Make sure to add all necessary setters and getters as well as other methods. The class Coffee implements an interface HowToMakeDrink. The interface has the following method: public interface HowToMakeDrink { public void prepare (); } The prepare method will...
JAVA Problem: Coffee do not use ArrayList or Case Design and implement a program that manages coffees. First, implement an abstract class named Coffee. The Coffee class has three member variables: coffee type, price, and store name. The Coffee class has an abstract method name ingredient. Make sure to add all necessary setters and getters as well as other methods. The class Coffee implements an interface HowToMakeDrink. The interface has the following method: public interface HowToMakeDrink { public void prepare ();...
Problem: Coffee(Java) Design and implement a program that manages coffees. First, implement an abstract class named Coffee. The Coffee class has three member variables: coffee type(does not mention the data type of the variable coffeeType), price, and store name. The Coffee class has an abstract method name ingredient. Make sure to add all necessary setters and getters as well as other methods. The class Coffee implements an interface HowToMakeDrink. The interface has the following method: public interface HowToMakeDrink { public...
PRG/421 Week One Analyze Assignment – Analyzing a Java™Program Containing Abstract and Derived Classes 1. What is the output of the program as it is written? (Program begins on p. 2) 2. Why would a programmer choose to define a method in an abstract class (such as the Animal constructor method or the getName()method in the code example) vs. defining a method as abstract (such as the makeSound()method in the example)? /********************************************************************** * Program: PRG/421 Week 1 Analyze Assignment * Purpose: Analyze the coding for...
java questions , help me and answer them please ! 6. Which of the following classes define a legal abstract class? 1: class A 2: abstract void unfinished 4: 1: public class abstract A 2: abstract void unfinished 1: class A 2: abstract void unfinished 3: 1: abstract class A 2: protected void unfinished 3: 1: abstract class A 2: abstract void unfinished 3: 1: class A 2: abstract int unfinished 3: 7. Suppose A is an interface. Can you...