need help with the bottom screenshots please i will include all the other codes
ID: 3733412 • Letter: N
Question
need help with the bottom screenshots please
i will include all the other codes below
public class Location {
private static final double EARTH_RADIUS_MILES = 3963.1676;
private double latitude;
private double longitude;
public Location() {
this.latitude = 0;
this.longitude = 0;
}
public Location(double lat, double lon) {
this.latitude = lat;
this.longitude = lon;
}
public double getLatitude() {
return latitude;
}
public double getLongitude() {
return longitude;
}
public void setLatitude(double lat) {
this.latitude = lat;
}
public void setLongitude(double lon) {
this.longitude = lon;
}
public double distanceFrom(Location other) {
double lat1 = Math.toRadians(this.getLatitude());
double lon1 = Math.toRadians(this.getLongitude());
double lat2 = Math.toRadians(other.getLatitude());
double lon2 = Math.toRadians(other.getLongitude());
double cosC = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1)
* Math.cos(lat2) * Math.cos(lon1 - lon2);
double arcLenC = Math.acos(cosC);
return arcLenC;
}
}
Place.java
public class Place {
private String name;
private String description;
private Location location;
//Place(name : String, desc : String, latitude : double, longitude : double)
public Place(String name, String desc, double latitude, double longitude){
this.name = name;
this.description = desc;
this.location = new Location(latitude, longitude);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
public void setLocation(double latitude, double longitude) {
this.location = new Location(latitude, longitude);
}
public String getIdentificationString(){
return this.name + "," + this.description + "," + this.location.toString();
}
public String toString(){
return getIdentificationString();
}
}
public class Attraction extends Place {
private int type;
private double price;
public Attraction() {
}
public Attraction(String name, String desc, double latitude, double longitude, double price, int type) {
super(name, desc, latitude, longitude);
this.type = type;
this.price = price;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public boolean hasAnimals() {
if (this.type == 1 || this.type == 2) {
return true;
}
return false;
}
@Override
public String toString() {
if (this.hasAnimals())
return super.toString() + " Tickets average $" + this.price + " and feature exciting animals";
else
return super.toString() + " Tickets average $" + this.price;
}
}
public class Eatery extends Place {
private double cost;
private String cuisine;
private int starRating;
public Eatery(String name, String desc, double latitude, double longitude, String cuisine, double cost,
int starRating) {
super(name, desc, latitude, longitude);
this.cost = cost;
this.cuisine = cuisine;
this.starRating = starRating;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
public String getCuisine() {
return cuisine;
}
public void setCuisine(String cuisine) {
this.cuisine = cuisine;
}
public int getStarRating() {
return starRating;
}
public void setStarRating(int starRating) {
this.starRating = starRating;
}
public String ratingToStars() {
String s = "";
for (int i = 0; i < this.starRating; i++) {
s = s + "*";
}
return s;
}
public String getCostSymbols() {
if (cost < 25.0) {
return "$";
} else if (cost > 25.0 && cost < 50.0) {
return "$$";
} else if (cost > 50.0 && cost < 75.0) {
return "$$$";
} else if (cost > 75.0 && cost < 100.0) {
return "$$ $$";
} else {
return "$$ $$+";
}
}
@Override
public String toString() {
return super.toString() + " Price: " + this.getCostSymbols()+" Rating: "+this.ratingToStars();
}
}
Explanation / Answer
PlacesToGo.java class
Destination.java class
Place.java class
Attraction.java class
Eatery.java class
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.