Placeholder

PRG 420 Week 2 Individual Assignment Triangle Rectangle Polygon

$9.99

For this assignment, you will apply what you learned in analyzing Java™ code so far in this course by writing your own Java™ program.
The Java™ program you write should do the following:
Accept user input that represents the number of sides in a polygon. Note: The code to do this is already written for you.
If input value is not between 3 and 5, display an informative error message
If input value is between 3 and 5, use a switch statement to display a message that identifies the correct polygon based on the number of sides matching the input number (e.g., triangle, rectangle, or polygon)
Complete this assignment by doing the following:
Download tnd unzip ahe linked Week Two Coding Assigment Zip File.
Read the file carefully, especially the explanatory comments of what the existing code does.
Add your name and the date in the multi-line comment header.
Refer to the following linked Week Two Recommended Activity Zip File to see examples of how to code all of the Java™ statements (i.e., switch, println(), and if-then-else) you will need to write to complete this assignment.
Replace the following lines with Java code as directed in the file:
• LINE 1

Description

For this assignment, you will apply what you learned in analyzing Java™ code so far in this course by writing your own Java™ program.
The Java™ program you write should do the following:
Accept user input that represents the number of sides in a polygon. Note: The code to do this is already written for you.
If input value is not between 3 and 5, display an informative error message
If input value is between 3 and 5, use a switch statement to display a message that identifies the correct polygon based on the number of sides matching the input number (e.g., triangle, rectangle, or polygon)
Complete this assignment by doing the following:
Download tnd unzip ahe linked Week Two Coding Assigment Zip File.
Read the file carefully, especially the explanatory comments of what the existing code does.
Add your name and the date in the multi-line comment header.
Refer to the following linked Week Two Recommended Activity Zip File to see examples of how to code all of the Java™ statements (i.e., switch, println(), and if-then-else) you will need to write to complete this assignment.
Replace the following lines with Java code as directed in the file:
• LINE 1
• LINE 2
Comment each line of code you add to explain what you intend the code to do.
Test and modify your Java™ program until it runs without errors and produces the results as described above.
Note: Refer to this week’s analyzing code assignment if you need help.
Submit your Java source (.java) code file using the Assignment Files tab.
SCREENSHOTS
SOLUTION
PAYMENT
PRG 420 Week 2 Individual Assignment
PRG 420 Week 2 Individual Assignment
PRG 420 Week 2 Individual Assignment
The solution consists of:
A Java program includes fully commented
A Netbeans project in case you want to run the project on your computer.
Screenshots while running program
Attachments [Move over files to preview content of those files]
PRG_420_Week_2.zip (309.85 KB)
Netbeans Project
PRG420Week2
pom.xml
src
main
java
PRG420Week2.java
test
java
target
classes
.netbeans_automatic_build
PRG420Week2.class
generated-sources
annotations
maven-status
maven-compiler-plugin
compile
default-compile
createdFiles.lst
inputFiles.lst
test-classes
.netbeans_automatic_build
PRG420-Week-2-Screenshot-1.png
PRG420-Week-2-Screenshot-2.png
PRG420-Week-2-Screenshot-3.png
PRG420-Week-2-Screenshot-4.png
PRG420-Week-2-Screenshot-5.png
Source Code
PRG420Week2.java
Preview PRG420Week2.java
xxxxxx xxxx.xxxx.xxxxxxx;
xxxxxx xxxxx xxx420xxxx2 {
public static void main(String[] args) { String userInputStringOfAngles; // Declare a variable of type String to capture user input int numberOfAngles; // Declare a variable of type int to hold the converted user input Scanner myInputScannerInstance = new Scanner(System.in); // Recognize the keyboard System.out.println(“Please type the integer 3, 4, or 5 and then press Enter: “); // Prompt the user userInputStringOfAngles = myInputScannerInstance.next(); // Capture user input as string numberOfAngles = Integer.parseInt(userInputStringOfAngles); // Convert the string to a number in case this will be useful later
// xxxx 1. xxxx xx xxxxxxxxx xxxxxxx xxxx xxxxx xx xxx xx xxxxxx xxxx xxxx
xx (xxxxxxxxxxxxxx < 3 || xxxxxxxxxxxxxx > 5) {
xxxxxx.xxx.xxxxxxx(“xxxxxxx xxxx, xxxxxx xx xxxxxx xxxx xx xx xxx xxxxx xx 3 xxx 5”);
xxxxxx.xxxx(0);
}
// xxxx 2. xxxxxx xxxx xx xxxxx xxxxxxx “xxxxx” xxxxxxx xxxxx xx xxxx xxxxx xxxx xxxx
Preview PRG420Week2.java
xxxxxx xxxx.xxxx.xxxxxxx;
xxxxxx xxxxx xxx420xxxx2 {
public static void main(String[] args) { String userInputStringOfAngles; // Declare a variable of type String to capture user input int numberOfAngles; // Declare a variable of type int to hold the converted user input Scanner myInputScannerInstance = new Scanner(System.in); // Recognize the keyboard System.out.println(“Please type the integer 3, 4, or 5 and then press Enter: “); // Prompt the user userInputStringOfAngles = myInputScannerInstance.next(); // Capture user input as string numberOfAngles = Integer.parseInt(userInputStringOfAngles); // Convert the string to a number in case this will be useful later
// xxxx 1. xxxx xx xxxxxxxxx xxxxxxx xxxx xxxxx xx xxx xx xxxxxx xxxx xxxx
xx (xxxxxxxxxxxxxx < 3 || xxxxxxxxxxxxxx > 5) {
xxxxxx.xxx.xxxxxxx(“xxxxxxx xxxx, xxxxxx xx xxxxxx xxxx xx xx xxx xxxxx xx 3 xxx 5”);
xxxxxx.xxxx(0);
}
// xxxx 2. xxxxxx xxxx xx xxxxx xxxxxxx “xxxxx” xxxxxxx xxxxx xx xxxx xxxxx xxxx xxxx
Price: $15
Buy Now
Checkout
Added to cart
Buy More Save More
Buy at least TWO items & save up to 30% OFF your ENTIRE order!
Rack up instant rebates in your shopping cart. Simply add items to your cart, and see the savings add up.
Discounts will automatically be applied on eligible orders.
PRG 420 Week 2 Individual Assignment – $15.00
PRG 420 Week 3 Individual Assignment – $19.00
PRG 420 Week 4 Individual Assignment – $19.00
PRG 420 Week 5 Individual Assignment – $19.00
Add to Cart
Checkout
Added to cart
You May Also Like:
PRG 420 Week 1 Individual Assignment Hello World
PRG 420 Week 3 Individual Assignment For While and Do While Loops
PRG 420 Week 4 Individual Assignment Creates and Accesses an Array of Integers
PRG 420 Week 5 Individual Assignment Exception Handling

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.