Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Codes(FOR HELP): PlanetTesterV8.java : /** *@purpose:TestertocreatetwoPlanetV8objects * *@authorAPCSTeam *@versionFLVS2020 */ public class PlanetTesterV8 { public static void main ( String[]args ) { Stringname1= Jupiter ;
Codes(FOR HELP):
PlanetTesterV8.java :
/** *@purpose:TestertocreatetwoPlanetV8objects * *@authorAPCSTeam *@versionFLVS2020 */ publicclassPlanetTesterV8 { publicstaticvoidmain(String[]args){ Stringname1="Jupiter"; intdiam1=142984; Stringname2="Mars"; intdiam2=6794; doubleradius=0.0; PlanetV8spaceA=newPlanetV8(name1); radius=spaceA.calcRadius(diam1); System.out.println("Planet:"+name1+"\tRadius:"+radius); PlanetV8spaceB=newPlanetV8(name2,diam2); radius=spaceB.calcRadius(); System.out.println("Planet:"+name2+"\t\tRadius:"+radius); //createathirdPlanetV8object } }
PlanetV8java:
/** *@purpose:PlanetV8ObjectClass * *@authorAPCSTeam *@versionFLVS2020 * */ publicclassPlanetV8 { privateStringn; privatedoubled; //oneparameterconstructor,allprivateinstancevariablesinitialized publicPlanetV8(Stringname){ n=name; d=0.0; } //twoparameterconstructor publicPlanetV8(Stringname,doublediam){ n=name; d=diam; } publicStringgetName(){ returnn; } publicdoublegetDiam(){ returnd; } publicvoidsetName(Stringname){ n=name; } publicvoidsetDiam(doublediam){ d=diam; } publicdoublecalcRadius() { doubleradius=0.0; radius=d/2.0; returnradius; } //overloadedmethod publicdoublecalcRadius(intd) { doubleradius=0.0; radius=d/2.0; returnradius; } }
GradeV3Object.java (CODE):
#includeusing namespace std; class CRectAreaV3 { private: int length; int breadth; public: CRectAreaV3 (int,int); int areaofrect () { return (length * breadth); } int length1() { return length; } int breadth1() { return breadth; } }; CRectAreaV3::CRectAreaV3(int x, int y) { length = x; breadth = y; } int main () { CRectAreaV3 myrectangle (2,2); cout <<"Length"<< "\t\t" << "Width" << "\t\t" << "Area" <<endl; cout <<"========================================="<<endl; cout< "\t\t" < "\t\t" < endl; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started