CMPS 260 Programming Assignment #1 solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

Assignment description
First, create an Intellij Java project and name it “pa1_your-id”. In method main, write the Java code to read
(from user input) the length and width of a rectangle, plus the units to be used. The program then outputs
the area of the rectangle to 3 decimal places.
Tip: Consult 4.6 in the text for output formating information.
Example Run 1 (with user input in red):
Enter length: 1.23456
Enter width: 7.8901
Enter units: meters
area: 9.741 square meters
Example Run 2 (with user input in red):
Enter length: 1.5
Enter width: 9.2
Enter units: inches
area: 13.800 square inches
Example Run 3 (with user input in red):
Enter length: 2.3
Enter width: 5.9876
Enter units: miles
area: 13.771 square miles
Requirements
• A reference variable and instance object of class java.util.Scanner must be used to read the input from
the user.
CMPS 260 Spring 2019 Programming Assignment #1 2
Additional Requirements
(a) Identifiers must be descriptive, i. e. must self document. The only exception granted is in the case of a
“for variable”, that is a variable created as a simple counter as in the control variable in a “for” loop
statement.
(b) Indention of all code blocks (compound statements, anything in braces), including single statements
following selection or while statements, is required.
(c)The main “.java” file [the one with the method public static void main(String[] args)] of your Intellij
projects must contain this minimal documentation as the first lines of the file:
// Your Name
// Your ID
// CMPS 260
// Programming Assignment : #
// Due Date :
// Program Description: (a brief description of actions of your code)
// Certificate of Authenticity:
(Choose one of the two following forms:)
// I certify that the code in the method function main of this project is entirely my own
// work.
{or}
// I certify that the code in method function main of this project is entirely my own work., but I
// received some assistance from {name}. Follow this with a description of the type of assistance.
// (For example, if you consulted a book, and your solution incorporates ideas found in the book,
// give appropriate credit; that is, include a bibliographical reference.) Note: You do not have to
// list the text, the author of the course text or the instructors examples.
Submitting
In Intellij, select File, Export to Zip File and click OK to save the Zip archive file. Finally, upload the zip
archive file to Moodle.
Helpful Hint: Keep a backup copy of your project folder on a Google Drive, a Drop Box Account, a USB
memory device, etc., or even on Moodle! Finally, once you turn in your final version, create a copy
before the due date and do not change this copy in any way. This final copy can be consulted if there is
an upload disaster, but only if the “.java” files have not been changed in any way after the due date.