

This is a java file and I am very confused on how to do this project! please help!!
//Java code
//Create separate file for each class and file name must match the class name
import java.text.DecimalFormat;
/**
* class Ellipsoid
*/
public class Ellipsoid {
//Ellipsoid fields
//three axes a,b, and c
//declare and initialize fields
private String label="";//empty string
private double a=0;//initialize to 0
private double b=0;//initialize to 0
private double c=0;//initialize to 0
//Constructor with args
public Ellipsoid(String labelIn, double aIn, double bIn, double cIn) {
// use setters to initialize fields
setLabel(labelIn);
setA(aIn);
setB(bIn);
setC(cIn);
}
/**
*
* @return label as String
*/
public String getLabel() {
return label;
}
/**
*
* @param label
* @return if String is not null
* set the label to trimmed String
* return true
*/
public boolean setLabel(String label)
{
if(label!= null)
{
this.label = label.trim();
return true;
}
else
return false;
}
/**
*
* @return field a as int
*/
public double getA() {
return a;
}
/**
*
* @param a
* @return if a>0 set the a to passed value as arg
* and return true
*/
public boolean setA(double a)
{
if(a>0)
{
this.a= a;
return true;
}
else
return false;
}
/**
*
* @return field b as int
*/
public double getB() {
return b;
}
/**
*
* @param b
* set the b to passed value as arg
* @return true if b>0
*/
public boolean setB(double b)
{
if(b>0)
{
this.b=b;
return true;
}
else
return false;
}
/**
*
* @return field c as int
*/
public double getC() {
return c;
}
/**
*set the c to passed value as arg
* @param c
* @return true if c>0
*/
public boolean setC(double c)
{
if(c>0)
{
this.c= c;
return true;
}
else
return false;
}
/**
*
* @return volume calculated as double
*/
public double volume()
{
return (4* Math.PI*a*b*c)/3;
}
/**
*
* @return calculated surfaceArea as double
*/
public double surfaceArea()
{
double surfaceA = (Math.pow((a*b),1.6)+Math.pow((a*c),1.6)+Math.pow((b*c),1.6))/3;
surfaceA = 4*Math.PI*Math.pow(surfaceA,(1.0/1.6));
return surfaceA;
}
/**
*
* @return String representation of Ellipsoid object
*/
@Override
public String toString() {
// set the pattern of double value
DecimalFormat decimalFormat = new DecimalFormat("#,##0.0###");
return "Ellipsoid \""+label+"\" with axes a = "+getA()+", b = "+getB()+", c = "+getC()
+" units has:\n\tvolume = "+decimalFormat.format(volume())+" square units" +
"\n\tsurface area = "+decimalFormat.format(surfaceArea())+" cubic units";
}
}
//==============================
import java.util.Scanner;
public class EllipsoidApp {
public static void main(String[] args)
{
// Create object of Ellipsoid
Ellipsoid ellipsoid1 = new Ellipsoid("",0,0,0);
// Scanner object to get input
Scanner input = new Scanner(System.in);
//Prompt user for enter label,a b, and c
System.out.println("Enter label and axes a, b, c for an ellipsoid. ");
System.out.print("label: ");
String label = input.nextLine();
System.out.print("a: ");
double a = Double.parseDouble(input.next());
if(!ellipsoid1.setA(a))
{
System.err.println("Error: axes value must be positive.");
System.exit(0);
}
System.out.print("b: ");
double b = Double.parseDouble(input.next());
if(!ellipsoid1.setB(b))
{
System.err.println("Error: axes value must be positive.");
System.exit(0);
}
System.out.print("c: ");
double c = Double.parseDouble(input.next());
if(!ellipsoid1.setC(c))
{
System.err.println("Error: axes value must be positive.");
System.exit(0);
}
ellipsoid1 = new Ellipsoid(label,a,b,c);
System.out.println("\n"+ellipsoid1);
}
}
//Output

//If you need any help regarding this solution....... please leave a comment...... thanks
This is a java file and I am very confused on how to do this project!...
C# programming
50 pts Question 2:2 1- Create the base class Book that has the following instance variables, constructor, and methods title (String) isbn (String) authors (String) publisher (String) edition ( int) published year (int) Constructor that takes all of the above variables as input parameters. set/get methods ToString method// that return sting representation of Book object. 2-Create the sub class New_Book that is derived from the base class Book and has the following instance variables, constructor, and methods: title...
1- Create the base class Book that has the following instance variables, constructor, and methods title ( String) isbn ( String) authors (String) publisher (String) edition ( int) published_year (int) Constructor that takes all of the above variables as input parameters. set/get methods ToString method // that return sting representation of Book object. 2- Create the sub class New_Book that is derived from the base class Book and has the following instance variables, constructor, and methods: title ( String) isbn...
Need help creating a Java program with mandatory
requirements!
VERY IMPORTANT: The George account class instance must be in the
main class, and the requirement of printing a list of transactions
for only the ids used when the program runs(Detailed in the
Additional simulation requirements) is extremely important! Thank
you so very much!
Instructions: This homework models after a banking situation with ATM machine. You are required to create three classes, Account, Transaction, and the main class (with the main...
Language: Java For this file, it should be concrete. I don't know how to write a code with the following private field & associated getter methods: final String NAME - a constant that represents the name of a location final double LATITUDE - a constant that represents the latitude (x) of that location final double LONGITUDE - a constant double represents the longitude (y) of that location Then, create a following constructor to initialize Location(String name, double lat, double long)...
Java Program Please help me with this. It should be pretty basic and easy but I am struggling with it. Thank you Create a superclass called VacationInstance Variables destination - String budget - double Constructors - default and parameterized to set all instance variables Access and mutator methods budgetBalance method - returns the amount the vacation is under or over budget. Under budget is a positive number and over budget is a negative number. This method will be overwritten in...
JAVA QUESTION 16 Write and submit the java source for the following class specification: The name of the class is Question_16 Class Question_16 has 3 instance variables: name of type String, age of type int and height of type double. Class Question_16 has the following methods: print - outputs the data values stored in the instance variables with the appropriate label setName - method to set the name setAge - method to set the age setHeight - method to set...
Start a new project in NetBeans that defines a class Person with the following: Instance variables firstName (type String), middleInitial (type char) and lastName (type String) (1) A no-parameter constructor with a call to the this constructor; and (2) a constructor with String, char, String parameters (assign the parameters directly to the instance variables in this constructor--see info regarding the elimination of set methods below) Accessor (get) methods for all three instance variables (no set methods are required which makes...
Code in JAVA
UML
//TEST HARNESS
//DO NOT CHANGE CODE FOR TEST HARNESS
import java.util.Scanner; // Scanner class to support user input
public class TestPetHierarchy
{
/*
* All the 'work' of the process takes place in the main method. This is actually poor design/structure,
* but we will use this (very simple) form to begin the semester...
*/
public static void main( String[] args )
{
/*
* Variables required for processing
*/
Scanner input = new Scanner( System.in...
Hello, I need some help creating this class in Java. This is for a larger project. I am using Eclipse if that helps 1. Create a class named State that will store information about a state and provide methods to get, and set the data, and compare the states by several fields. a. Fields: Name, Capital City, Abbreviation, Population, Region, US House Seats b. Constructor c. Get and set methods for each field d. Compare method to compare State objects...
Amusement Park Programming Project Project Outcomes Use the Java selection constructs (if and if else). Use the Java iteration constructs (while, do, for). Use Boolean variables and expressions to control iterations. Use arrays or ArrayList for storing objects. Proper design techniques. Project Requirements Your job is to implement a simple amusement park information system that keeps track of admission tickets and merchandise in the gift shop. The information system consists of three classes including a class to model tickets, a...