How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask ratheeshravi Your Own Question

ratheeshravi
ratheeshravi, Engineer
Category: Homework
Satisfied Customers: 138
Experience:  Engineer with 10+ years of experience in Software development and design.
50071857
Type Your Homework Question Here...
ratheeshravi is online now
A new question is answered every 9 seconds

1- After compiling my java program, I have this error: illegal

Customer Question

1- After compiling my java program, I have this error: illegal character use
2- I have a help from Logic pro but I can't open the file
URL=http://wikisend.com/download/588598/Grade Formatter 1.2.zip]Grade Formatter 1.2.zip[/URL]
3-• 1.
Provide Java code for a simple class of your choice. Be sure to include at least one constructor, two methods and two fields. The fields should be private.
Create a test class to constuct and call the methods of your class.
Describe your class and demonstrate your code functions properly.
Respond to other student postings by testing their Unique classes.
2.
Discuss about the benefit of using a method. How do you define a method? How do you invoke a method?
How is an argument passed in a method? Can the argument have the same name as its parameter?
What is method overloading? It is permissible to define two methods that have the same name but different parameter types?
3.
Let’s design and implement some methods to exercises the methods
Provide Java code for a method that would calculate the perimeter of a rectangle. Be sure to include an example call to your method and explain the code you developed. The program prompts the user to enter the width and height of the rectangle
Please help.
Submitted: 1 year ago.
Category: Homework
Expert:  ratheeshravi replied 1 year ago.
Hi,
Thank you for posting the question in JA, I will help you with this.
Would you like me to debug and fix the problem in your program Or create a new program for you?
Please confirm.
Regards
Ratheesh
Customer: replied 1 year ago.

First, I have program that is correct but I'm having format error. I'm compiling my program in CMD screen. This is my program: Do you know why it is not compiling?

/*
a Java class named Polygon that contains

*/
public class Polygon {
/**
* A private int data field named numSides that defines the number
* of sides of the polygon. The default value should be 4.

*/
private int numSides;
/**
* A private double data field named sideLength that defines the length of
* each side. The default value should be 10.0.

*/
private double sideLength;
/**
* A private double data field named xCoord that
* defines the x-coordinate of the center of the polygon.
* The default value should be 0.0.

*/
private double xCoord=0;

/**
* A private double data field named yCoord that defines the y-coordinate
* of the center of the polygon. The default value should be 0.0.

*/
private double yCoord=0 ;

/**
* A private double data field named apothem that defines the apothem
* of the polygon. The default value should 5.0.

*/
private double apothem;

/**
* A private double data filed named perimeter that defines
* the perimeter of the polygon. The default value should 20.0.

*/
private double perimeter ;

/**
* A no argument constructor that creates a Polygon using the default
* number of sides, default side length, default x- and y-coordinates,
* and the default apothem.

*/
public Polygon() {
numSides=4;
sideLength=10;
xCoord = 0;
yCoord = 0;
apothem=5 ;
perimeter=20.0 ;
}

/**
* A constructor that creates a Polygon using a specified number of sides,
* side length, x- and y-coordinates and the apothem

* @param numSides
* @param sideLength
* @param xCoord
* @param yCoord
*/
public Polygon(int numSides, double sideLength, double xCoord, double yCoord, double apothem, double perimeter) {
this.numSides = numSides;
this.sideLength = sideLength;
this.xCoord = xCoord;
this.yCoord = yCoord;
this.apothem = apothem;
perimeter = numSides * sideLength;
}

/**
* A getArea() method that returns a double value representing
* the area of the polygon. (Note the area of a regular Polgon
* can be calculated from 1/2 * Apothem*Perimeter)

* @return
*/
public double getArea() {
return (1/2.0)*(apothem * perimeter);
}

//Getter and setter methods for all data fields
public int getNumSides() {
return numSides;
}

public void setNumSides(int numSides) {
this.numSides = numSides;
}

public double getSideLength() {
return sideLength;
}

public void setSideLength(double sideLength) {
this.sideLength = sideLength;
}

public double getxCoord() {
return xCoord;
}

public void setxCoord(double xCoord) {
this.xCoord = xCoord;
}

public double getyCoord() {
return yCoord;
}

public void setyCoord(double yCoord) {
this.yCoord = yCoord;
}

public double getApothem() {
return apothem;
}

public void setApothem(double apothem) {
this.apothem = apothem;
}

public double getPerimeter() {
return perimeter;
}

public void setPerimeter(double perimeter) {
this.perimeter = perimeter;
}

/***
* A toString() method that displays the number of sides, side length,
* x-coordinate, y-coordinate and apothem values in String format

* @return
*/
@Override
public String toString() {
return "NumSides=" + numSides + ", sideLength=" + sideLength + ", xCoord=" + xCoord + ", yCoord=" + yCoord+", Apothem="+apothem;
}

}

Expert:  ratheeshravi replied 1 year ago.
I will check it now
Customer: replied 1 year ago.

Please need now.

Expert:  ratheeshravi replied 1 year ago.
Hi,
I have tried compiling it now.
Just added the text in a file Polygon.java and compiled the same in the CMD window using command "javac Polygon.java".
It is compiling with out any problem.
The file I used is available here http://wikisend.com/download/417924/Polygon.java
If you are still getting the problem, please provide following info.
1. What is the javac version? (Use the command "javac -version" without quotes in command prompt )
2. Which OS you are using?
Regards
Ratheesh
Customer: replied 1 year ago.

1- java 1.8.0 45.

2-I received a reply from tutor that I can not open :http://www.wikisend.com/download/588598/LotteryDrawing.java

3- I need help with this one. but I want to solve 1 and 2 first

Provide Java code for a simple class of your choice. Be sure to include at least one constructor, two methods and two fields. The fields should be private.

Create a test class to constuct and call the methods of your class.

Describe your class and demonstrate your code functions properly.

Respond to other student postings by testing their Unique classes.

2.

Discuss about the benefit of using a method. How do you define a method? How do you invoke a method?

How is an argument passed in a method? Can the argument have the same name as its parameter?

What is method overloading? It is permissible to define two methods that have the same name but different parameter types?

3.

Let’s design and implement some methods to exercises the methods

Provide Java code for a method that would calculate the perimeter of a rectangle. Be sure to include an example call to your method and explain the code you developed. The program prompts the user to enter the width and height of the rectangle

Expert:  ratheeshravi replied 1 year ago.
1. Please download the Polygon.java I mentioned in the last reply to some folder and try to compile it. Please copy the full error details from the command prompt and provide it to me.
2. I am also not able to open this as the attachment is blocked as malicious content. It may be because it contains some executable applications. You may have to contact your tutor regarding this.
Please let me know if I should start working on Point.3
Customer: replied 1 year ago.

Error Public static void main(String[] args), or a javaFX application class must extend javaFX.application .application

Expert:  ratheeshravi replied 1 year ago.
THIS ANSWER IS LOCKED!

You need to spend $3 to view this post. Add Funds to your account and buy credits.
Customer: replied 1 year ago.

Error 160 : reaching end of file while parsing

Expert:  ratheeshravi replied 1 year ago.
Please let me when you are getting this error?
what are the commands/ steps executed?
Customer: replied 1 year ago.

no

Expert:  ratheeshravi replied 1 year ago.
Hi,
I will opt out of this question.
Another expert may join to help in this.
Regards
Ratheesh