Question

Project 3 Instructions 1. Due Date & Time: 09-26-2020 at 11:59 PM WHAT TO SUBMIT Submit...

Project 3 Instructions
1. Due Date & Time: 09-26-2020 at 11:59 PM

WHAT TO SUBMIT

Submit 1 zip file containing 4 files below to iLearn by the deadline. [30 points]

  • ● 3 JAVA Files: TableBmiPro.java, MyOwnIdea.java. DiceRoll.java [24 points]

  • ● 1 File: Make a document that shows the screen captures of execution of your programs and learning

    points in Word or PDF. Please make sure you capture at least 2 executions for 1 program, so 6 screen captures and one paragraph learning reflection for each [6 points]

    GUIDELINES FOR ALL PROJECTS:

  1. Each assignment includes a code portion and a non-code portion. Please submit both 2 portions.

    1. Code portion: Your source code files, only the files which you create and edit.

    2. Non-code portion: Your assignment report, only 1 Word or PDF file.

  2. Please submit all required files separately, un-zipped, via iLearn Assignments Submission

  3. Always read through the entire assignment before starting and submitting any of it. Missing files or

    missing requirements will result in deducted points

Part 1: BMI History Pro [8 points]

  1. Prompt our user to enter his/her height in feet and inches (two integers).

  2. Prompt our user to enter his/her lowest weight in pounds (an integer).

  3. Prompt our user to enter his/her heaviest weight in pounds (an integer).

  4. Print a table of Body Mass Index (BMI) for the height entered:

a) Weights range from the low weight to the high weight, at increments of 5 pounds.
▪ This means to get more than 1 line low weight and high weight should have more than 5 pounds

  

of difference

CSC 210 PROJECT 3 FALL 2020

▪ To get additional decimals behind decimal point, you may want to cast one of the variables into a float or a double

b) Each row of the table lists

  • ▪ The value of WEIGHT (an integer), followed by spaces, then

  • ▪ The value of BMI to four decimal places (a float), followed by spaces, then

  • ▪ The CONDITION whether overweight (BMI > 25), or not overweight (BMI <= 25).

5. Document our code carefully. Our program output must be identical to the sample output (except author name).

OUTPUT OF SAMPLE RUN FOR PART 1

Part 2: DiceRoll [8 points]

1. Make a dice and rolls it 10000 times. Each time you count how many times each face [1-6] appears and check if the random number actually works. Please make your program to roll once and then make it roll 10 times for easier debugging. And then you can increase the number of roll to be 10000. You can use this NUMBER_OF_ROLL as a constant and changes when needed. Or you can make it a user input. However, you should not use this number of roll hard-coded!!!

2. Comment your code carefully assuming you are teaching your friend to learn from your comments.

CSC 210

PROJECT 3

FALL 2020

3. Include screenshots and notes in your report.

OUTPUT OF SAMPLE RUNS FOR PART 2

[When the NUMBER_OF_ROLL is 100] Occurrence of each face is
11, 20, 22, 13, 19, 15: 100.0

Therefore the probability of each face is 0.11, 0.2, 0.22, 0.13, 0.19, 0.15

[When the NUMBER_OF_ROLL is 10000] Occurrence of each face is
1667, 1700, 1665, 1683, 1616, 1669: 10000.0

Therefore the probability of each face is 0.1667, 0.17, 0.1665, 0.1683, 0.1616, 0.1669

Part 3: Your own idea [8 points]

It can be similar to part 1 or 2.

Please use what you learned from Loops.

a. In Assignment 1, Part 3 and in Assignment 2, Part 2: Your own idea, you created your own idea of a program. For this assignment, you must improve upon your first program by adding what you learned from Loops

b. Must include Loops, using either “for”, or “while”
c. And, must use the loop to output more than 1 line of result
d. Must provide an explanation to the user of your idea “This program will help you... ” (2 points)

FILE NAME REQUIREMENTS MyOwnIdea.Java

Part 4: Comment your code

CSC 210

PROJECT 3

FALL 2020

Every Java file you write in this assignment will require you to include descriptive comments. In this assignment, you are tasked with writing a descriptive
1. Headers
2. Comments

You can write comments in two ways:
• Single-line comments using the // notation.
• Multi-line comments using the /* and */ notation.

a. Include a proper header at the top of every Java file. Figure 1

Header Format

/*
* Assignment <assignment number> * Description: <program description> * Name: <your name>
* ID: <your SFSU ID number>
* Class: CSC 210-<section number>
* Semester: <current semester>
*/

Replace each tag (such as <assignment number>) with the appropriate text.

You should adhere to this format as closely as possible. You do not need to include the <> symbols in your header fields.

b. Only if you work with a Study Buddy, include your Buddy’s name in your header at the top of every

Java file. Figure 1

Header Format

CSC 210

PROJECT 3

FALL 2020

/*
* Assignment <assignment number> * Description: <program description> * Name: <your name>
* Teammate: <Study Buddy name>
* ID: <your SFSU ID number>
* Class: CSC 210-<section number>
* Semester: <current semester>
*/

Replace each tag (such as <assignment number>) with the appropriate text.
You should adhere to this format as closely as possible. You do not need to include the <> symbols in your

header fields. Figure 1

CSC 210
b. Place your comments at the top of each Statement,

below in Figure 2:

Figure 2

PROJECT 3

An example of commenting codes is included

FALL 2020

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Part1

/*

* Assignment <assignment number> * Description: <program description> * Name: <your name>

* ID: <your SFSU ID number>

* Class: CSC 210-<section number>

* Semester: <current semester>

*/

import java.util.Scanner;

class TableBmiPro{

public static void main(String args[]){

Scanner sc = new Scanner(System.in); // Creating Scanner object to read from Console

int hInches,hFeet,lWeight,hWeight;

System.out.println("Height in Feet and Inches : ");

System.out.print("Feet ? ");

hFeet = sc.nextInt();

System.out.print("Inches ? ");

hInches = sc.nextInt();

System.out.print("Lowest Weight in pounds ? ");

lWeight = sc.nextInt();

System.out.print("Heaviest Weight in pounds ? ");

hWeight = sc.nextInt();

hInches = hInches + hFeet * 12; // Converting feet to inches and append to the inches

float bmi = (float) lWeight/(hInches*hInches) * 703; // calculating bmi

if(bmi<=25){

System.out.println(String.format("\nWeight:%d BMI:%.4f not overweight (BMI <= 25)",lWeight,bmi));

}else{

System.out.println(String.format("\nWeight:%d BMI:%.4f overweight (BMI > 25)",lWeight,bmi));

}

if(hWeight-lWeight>=5){

bmi = (float) hWeight/(hInches*hInches) * 703; // calculating bmi

if(bmi<=25){

System.out.println(String.format("\nWeight:%d BMI:%.4f not overweight (BMI <= 25)",hWeight,bmi));

}else{

System.out.println(String.format("\nWeight:%d BMI:%.4f overweight (BMI > 25)",hWeight,bmi));

}

}

}

}

abhi@pop-os :-/Abhi/Chegg/java/BMIMOIDR$ javac TableBmiPro.java abhi@pop-os:-/Abhi/Chegg/java/BMIMOIDR$ java TableBmiPro Heig

DiceRoll.java

/*

* Assignment <assignment number> * Description: <program description> * Name: <your name>

* ID: <your SFSU ID number>

* Class: CSC 210-<section number>

* Semester: <current semester>

*/

import java.util.Random;

class DiceRoll{

public static void main(String args[]){

int faces[] = {0,0,0,0,0,0}; // Initialising each faces with 0

int face;

int num_of_rolls = 10000;

Random rand = new Random();

System.out.println("Occurrence of each face is");

for(int i=0;i<num_of_rolls;i++){

face = rand.nextInt(6); // It generates 0,1,2,3,4,5

faces[face]++; // generated number becomes index of the array and

// each index number of occurances of faces and hence incremented

}

for(int i=0;i<6;i++){

System.out.print(faces[i]+" ");

}

System.out.println(": "+num_of_rolls);

System.out.println("Therefore the probability of each face is: ");

for(int i=0;i<6;i++){

System.out.print(String.format("%.4f ",(float)faces[i]/num_of_rolls));

}

System.out.println();

}

}

abhi@pop-os :-/Abhi/Chegg/java/BMIMOIDR$ javac DiceRoll.java abhi@pop-os :-/Abhi/Chegg/java/BMIMOIDR$ java DiceRoll Occurrenc

MyOwnIdea.java

/*

* Assignment <assignment number> * Description: <program description> * Name: <your name>

* ID: <your SFSU ID number>

* Class: CSC 210-<section number>

* Semester: <current semester>

*/

import java.util.Scanner;

class MyOwnIdea{

public static void main(String args[]){

Scanner sc = new Scanner(System.in); // Creating Scanner object to read from Console

int hInches,hFeet,lWeight,hWeight;

System.out.println("Height in Feet and Inches : ");

System.out.print("Feet ? ");

hFeet = sc.nextInt();

System.out.print("Inches ? ");

hInches = sc.nextInt();

System.out.print("Lowest Weight in pounds ? ");

lWeight = sc.nextInt();

System.out.print("Heaviest Weight in pounds ? ");

hWeight = sc.nextInt();

hInches = hInches + hFeet * 12; // Converting feet to inches and append to the inches

while(lWeight<=hWeight){ // for each 5 pounds increase

float bmi = (float) lWeight/(hInches*hInches) * 703; // calculating bmi

if(bmi<=25){

System.out.println(String.format("\nWeight:%d BMI:%.4f not overweight (BMI <= 25)",lWeight,bmi));

}else{

System.out.println(String.format("\nWeight:%d BMI:%.4f overweight (BMI > 25)",lWeight,bmi));

}

lWeight+=5;

}

}

}

abhicpop-os:-/Abhi/Chegg/java/BMIMOIDR$ javac Myownldea. Java abhi@pop-os :-/Abhi/Chegg/java/BMIMOIDR$ java MyOwnIdea Height

Add a comment
Know the answer?
Add Answer to:
Project 3 Instructions 1. Due Date & Time: 09-26-2020 at 11:59 PM WHAT TO SUBMIT Submit...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The Course Project can be started in Week 7 and is due by 11:59 pm CT...

    The Course Project can be started in Week 7 and is due by 11:59 pm CT Saturday of Week 8. It must follow standard code formatting and have a comment block at the top of the code file with a detailed description of what the program does. Functions must have a comment block with a detailed description of what it does. Pseudocode must be provided in the comment block at the top of the file. This program will allow the...

  • Program 3. Decisions Due: Friday, February 7 by 11:59 PM Overview For this program, design a...

    Program 3. Decisions Due: Friday, February 7 by 11:59 PM Overview For this program, design a wage calculator for a single user. The program will use the user's number of hours worked and their hourly wage to calculate: Gross Pay Deduction Net Pay The Gross Pay is the amount that the user is paid before any deduction is applied. The pay amount is based upon the number of hours worked. If 40 hours or less were worked, the gross pay...

  • Files, Pointers and Dynamic Memory Allocation, and Structs Due date/time: Tuesday, Nov 26th, 11:00 PM. WRITE...

    Files, Pointers and Dynamic Memory Allocation, and Structs Due date/time: Tuesday, Nov 26th, 11:00 PM. WRITE A C++ PROGRAM (USE DYNAMIC MEMORY ALLOCATION) THAT READS N CUSTOMER RECORDS FROM A TEXT FILE (CUSTOMERS.TXT) SUCH THAT THE NUMBER OF THE RECORDS IS STORED ON THE FIRST LINE IN THE FILE. EACH RECORD HAS 4 FIELDS (PIECES OF INFORMATION) AND STORED IN THE FILE AS SHOWN BELOW: Account Number (integer) Customer full name (string) Customer email (string) Account Balance (double) The program...

  • in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and...

    in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and follow the directions below carefully and perform the steps in the order listed. You will be solving one program as instructed and turning in your work electronically via an uploaded file within Eagle Online/Canvas and copy & paste the program to the Text Entry box as well. Make sure and check your work prior to uploading the assignment (NOTE: For Steps 1 & 2...

  • 9:09 PM Fri Sep 27 Ass1.pdf 9/21/2019 Ass1 Submit Assignment Due Sunday by 11:59pm Points 5...

    9:09 PM Fri Sep 27 Ass1.pdf 9/21/2019 Ass1 Submit Assignment Due Sunday by 11:59pm Points 5 Submitting a file upload File Types zip Goals: Write a C++ class with separate.h and.cpp file, use partially filled arrays, Create a new class called Library that uses a private string array to store the list of books The starter code can be downloaded from https://github.com/pisan 342/ass 1-starter (https://github.com/pisan 342/ass 1-starter) You need to submit ass1.zip with the following files in it. Put all...

  • Project [2]: Expressions and Operators Project Goals The goal of this project is to: 1. Get...

    Project [2]: Expressions and Operators Project Goals The goal of this project is to: 1. Get students familiar with expressions and operators. Important Notes: 1. Formatting: Make sure that you follow the precise recommendations for the output content and formatting. For example, do not change the text from “You’re walking through the woods and come upon a chest. Do you open it? 1 – yes 2 - no” to “Do you open the chest? ”. Your assignment will be auto-graded...

  • disregard Final Project 2 Due Sunday by 11 59pm Points 100 Submitting the upload Instructions For...

    disregard Final Project 2 Due Sunday by 11 59pm Points 100 Submitting the upload Instructions For this assignment, you will create flowchart using Flowgorithm and Pseudocode for the following program example You are to design a program for Alexander's Coffee Shop providing customer research data When a customer places an order, the clerk asks the customer for their zip code and age. The clerk enters this data as well as the number of ems purchased. The program should operate continuously...

  • NOTE: The blue marker is blocking a name. I need to replace with my own. So...

    NOTE: The blue marker is blocking a name. I need to replace with my own. So just put "yourlastname" as a substitution! PART1-Requirement Create a project named SP2019_LAB2PAR1 Add the source file name Sharelnvestment yourLastName.java and display the source file name as the first comment line Provide the pseudo-code of the following application before writing the code Using java code to provide an application that calculates the money returned to an inverster after a year where the name, number of...

  • Please help ASAP! C ++, linked list, etc. everything for the project is in the link...

    Please help ASAP! C ++, linked list, etc. everything for the project is in the link below. https://www.zipshare.com/download/eyJhcmNoaXZlSWQiOiIzZDIyN2UzYi1kNGFhLTRlMzEtYjMzZi00MDhmYzNiMjk3ZGMiLCJlbWFpbCI6Im1pMTQzNEBnbWFpbC5jb20ifQ== You should turn it in by blackboard. Each task should be in a separate unzipped folder named YourLastName_YourFirstInitial_taskN, where N is the task number inside a zipped file named: YourLastName_YourFirstInitial.zip. You may use code you have written previously and you may ask other members of the class questions about the assignment. However, you must do your own assignment; you may not use...

  • Project 8 – Populating a struct and saving it. This is another “switch” assignment. Rather like...

    Project 8 – Populating a struct and saving it. This is another “switch” assignment. Rather like the scenarios, here you must select someone else's posted .h file, post a claim, and using it, codepopulating their struct with values you choose. Here “populate” means to give each member a value, using assignment operators and strcpy ( ) as needed. This all assumes you completed Project 7 first! You can't skip ahead on this one. I populated the Cat fluffy in my...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT