In java please:
TotalCostForTicket interface
Create interface that includes one variable taxRate which is .09.
It also includes an abstract method calculateTotalPrice which has no parameters and returns a value of type double.
public abstract class Ticket {
//There is a public static instance variable of type double for the
basePrice.
public static double basePrice;
//
private int theaterNumber;
private int seatNumber;
private boolean isTicketSold;
private boolean isTicketReserved;
public Ticket(int theaterNumber, int seatNumber) {
this.theaterNumber = theaterNumber;
this.seatNumber = seatNumber;
isTicketReserved = isTicketSold = false;
}
public int getTheaterNumber() {
return theaterNumber;
}
public void setTheaterNumber(int theaterNumber) {
this.theaterNumber = theaterNumber;
}
public int getSeatNumber() {
return seatNumber;
}
public void setSeatNumber(int seatNumber) {
this.seatNumber = seatNumber;
}
public boolean isTicketSold() {
return isTicketSold;
}
public void setTicketSold(boolean ticketSold) {
isTicketSold = ticketSold;
}
public boolean isTicketReserved() {
return isTicketReserved;
}
public void setTicketReserved(boolean ticketReserved) {
isTicketReserved = ticketReserved;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Ticket ticket = (Ticket) o;
return theaterNumber == ticket.theaterNumber &&
seatNumber == ticket.seatNumber;
}
@Override
public String toString() {
return "Theater "+ getTheaterNumber()+", Seat Number:
"+getSeatNumber();
}
}
interface TotalCostForTicket {
double taxRate=0.09;
double calculateTotalPrice();
}
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
In java please: TotalCostForTicket interface Create interface that includes one variable taxRate which is .09. It...
Susceptible.java
interface Susceptible
{
public boolean infect(Disease disease);
public void forceInfection(Disease disease);
public Disease getCurrentDisease();
public void setImmune();
public boolean isImmune();
public Point getPosition();
}
Movable.java
interface Movable
{
public void move(int step);
}
public class Point {
private int xCoordinate;
private int yCoordinate;
/**
* Creates a point at the origin (0,0) and colour set to black
*/
public Point(){
xCoordinate = 0;
yCoordinate = 0;
}
/**
* Creates a new point at a given coordinate and colour...
NETBEANS JAVA BANK PROGRAM (TAKE SCREENSHOTS FROM NETBEANS INCLUDING OUTPUT PLEASE) Display the accounts for the current displayed customer PLEASEEEEEEEEEE package bankexample; import java.util.UUID; public class Customer { private UUID id; private String email; private String password; private String firstName; private String lastName; public Customer(String firstName, String lastName, String email, String password) { this.id = UUID.randomUUID(); this.firstName = firstName; this.lastName = lastName; this.email = email; this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String...
Java -Create an interface and implement it In the murach.db package, create an interface named IProductDB. This interface should specify this abstract method: public abstract Product get(String productCode); Modify the ProductDB class so it implements the IProductDB interface. Write the code for the new ‘get’ method. Then remove the getProductByCode method. In the Main class, modify the code so it works with the new ProductDB class. This code should create an instance of the IProductDB interface like this: IProductDB db...
Can the folllowing be done in Java, can code for all classes and code for the interface be shown please. Modify the GeometricObject class to implement the Comparable interface and define a static max method in the GeometriObject class for finding the larger of two GeometricObject objects. Write a test program that uses the max method to find the larger of two circles, the larger of two rectangles. The GeometricObject class is provided below: public abstract class GeometricObject { private...
Registry Java Programming 2) Interface Comparator: The method for comparing two objects is written outside of the class of the objects to be sorted. Several methods can be written for comparing the objects according to different criteria. Specifically, write three classes, DescriptionComparator, FirstOccComparator, and LastOccComparator that implement the interface java.util.Comparator. DescriptionComparator implements the interface Comparator. The method compare compares the description of two objects. It returns a negative value if the description of the first object comes before the description...
The current code I have is the following: package uml; public class uml { public static void main(String[] args) { // TODO Auto-generated method stub } } class Account { private String accountID; public Account(String accountID) { this.accountID = accountID; } public String getAccountID() { return accountID; } public void setAccountID(String accountID) { this.accountID = accountID; } @Override public String toString() { return "Account [accountID=" + accountID + "]"; } } class SuppliesAccount extends Account { private...
Assignment (to be done in Java):
Person Class:
public class Person extends Passenger{
private int numOffspring;
public Person() {
this.numOffspring = 0;
}
public Person (int numOffspring) {
this.numOffspring = numOffspring;
}
public Person(String name, int birthYear, double weight, double
height, char gender, int numCarryOn, int numOffspring)
{
super(name, birthYear, weight, height, gender,
numCarryOn);
if(numOffspring < 0) {
this.numOffspring = 0;
}
this.numOffspring = numOffspring;
}
public int getNumOffspring() {
...
Modify the library program as follows: Create a method in the LibraryMaterial class that accepts a string s as a parameter and returns true if the title of the string is equal to s. Create the same method for your library material copies. Note that it will need to be abstract in the LibraryMaterialCopy class MY CODE **************************************************************** LibraryCard: import java.util.List; import java.util.ArrayList; import java.time.LocalDate; import java.time.temporal.ChronoUnit; public class LibraryCard { private String id; private String cardholderName; ...
I Have a problem with my JAVA class "Directivo". In the " public double sueldo() " method, the instruction say "Calculate the salary of a Directivo the following way: Invoke method salary of the father and add him the extra bonus" My question is : How can I do this ? how can i implement that instruction in the public double sueldo() method public class Directivo extends Planta implements Administrativo{ private double bonoExtra; public Directivo( String nom, String...