Find Jobs
Hire Freelancers

Die Simulator and five Polygons

$10-30 USD

Completed
Posted about 9 years ago

$10-30 USD

Paid on delivery
Project 1. Write a Java program to simulate a die. A die has values of either 1, 2, 3, 4, 5 or 6 on the face. You should use the [login to view URL]() or the [login to view URL]() class to generate the values on the die. The program should prompt the user to enter how many times the die should be rolled. The output should show the results of each roll along with the total number of times 1, 2, 3, 4, 5 or 6 occurred for all rolls and the total sum comprised of the sum of all rolls. Here is a sample run: How many times do you want to roll the die? 10 Thank you! The die roll results for 10 rolls were: 2 3 4 5 3 2 6 2 1 6 The number of occurrences of each face were as follows: 1: 1 2: 3 3: 2 4: 1 5: 1 6: 2 The sum of die rolls was: 34 Project 2. Design a Java class named Polygon that contains: A private int data field named numSides that defines the number of sides of the polygon. The default value should be 4. A private double data field named sideLength that defines the length of each side. The default value should be 10.0. 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. 2 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. A no argument constructor that creates a Polygon using the default number of sides, default side length and default x- and y-coordinates. A constructor that creates a Polygon using a specified number of sides, side length and x- and y-coordinates. Getter and setter methods for all data fields A getPerimeter() method that returns a double value representing the sum of all sides. A toString() method that displays the number of sides, side length, x-coordinate and y-coordinate values in String format. Be sure your code compiles. (In the next question, you will create a TestPolygon class and test each of the methods) Write a Java test program, named TestPolygon, to create five different polygons. When creating the five polygons, create one using the no argument constructor. For the remaining four, feel free to use any number of sides, side length and x-, and y-coordinates that are not equal to the default values and not equal to each other. For each of the five polygons, call all of the methods and display the results. For example for a Polygon with 3 sides, side length of 2.0 and x-coordinate and y-coordinates of 1.0, the following output may be appropriate. toString() results: (3, 2.0, 1.0,1.0) getNumSides() results: 3 getSideLength() results: 2.0 getXCoord() results: 0.0 getYCoord() results: 0.0 getPerimeter() results: 6.0 setNumSides(4) results: 4 setSideLength(3) results: 3.0 setXCoord(2.0) results: 2.0 setYCoord(2.0) results: 2.0 Keep in mind, for five Polygons, you will have five different output results.
Project ID: 7107202

About the project

8 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
A proposal has not yet been provided
$20 USD in 1 day
0.0 (0 reviews)
0.0
0.0
8 freelancers are bidding on average $32 USD for this job
User Avatar
Hi, thank you for inviting me to do this project. I have read the requirements and I would like to do this project if given the opportunity. Let me know if you are interested so I can start. Thanks.
$15 USD in 1 day
4.9 (500 reviews)
6.9
6.9
User Avatar
I am very proficient in java. I have 12 years java developing experience. I have worked for 5 years, my work is online game developing, and mainly focus on server side, the language is java under linux, I am proficint in c++ also. I used java to make many great projects. For example, I made the tools which can convert PWScript(a script language created by our company) to c++ files. I made our own mobile games, and i am mainly responsible for the server side, and it was built using java. I can even show you the mobile game client. Please let expert help you.
$50 USD in 1 day
4.7 (26 reviews)
5.3
5.3
User Avatar
hi mate this is asad, i have a lot of experience in java programming, would surely help you out,cheers :)
$30 USD in 0 day
4.9 (26 reviews)
4.7
4.7
User Avatar
hey there.....we can do this DIE simulator in Java...please reply....we can get this done 100% accuracy....thank you....
$38 USD in 1 day
4.9 (31 reviews)
4.5
4.5
User Avatar
Hi, i will complete this job in a day probably. I just kept time 3 days for some kind of urgent things. I'm completely suitable for your work.
$35 USD in 3 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
moody, United States
5.0
4
Member since Feb 1, 2015

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.