Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help on this beginner level computer science lab. Please write in a very beginner/simple style coding for java for easy understanding. Completing the
I need help on this beginner level computer science lab. Please write in a very beginner/simple style coding for java for easy understanding. Completing the extra credit part isn't required. Thank you for your help! I will be sure to like, I know it is very important.
Overall rubric:
-Lab 2-User Input & Documentation OVERVIEW You will practice instance variables (fields), user input, console output, and java documentation. Part A: User Input, Instance Variables and Console Output Part B: Adding Javadoc to code Part C: Magic Square Part A: User Input, Instance Variables (fields), and Console Output 1) Each instance variable is defined by its datatype and a unique name. Because instance variables are most often "things", we generally use nouns as instance variable names. Note that in Java the convention for variable names is what's known as camel case. That is, the first word of the variable identifier is all lower-case letters. If multiple words are used in the identifier, the first character of every word after the first is upper case (like the hump on a camel). For example, a variable to hold your first name might have an identifier like firstName. A variable for the street of your address might just be street because it's only one word. A variable to hold your favorite movie might be named myFavoriteMovie. The table below shows the instance variables you will be using: Instance Variable Description Java Datatype Name String Street Number Int Street Name String City String State String Zip Code Int College Major String 800 number Java Identifier name streetNumber streetName city state zip major studentId Int 2) Create a new project called Lab2. Make sure to create a main/driver class if one is not provided by your IDE 3) In your main source code file, declare all of the instance variables in the table above. 4) Prompt the user to enter the information that will be stored in each instance variable See https://www.w3schools.com/java/java user input.asp for user input. 5) Display to the console all of the information the user entered. Your output should look like: Student Information: Name: Geoffrey Grimaud Address: 555 House Lane Big City, AA 11111 Student Id: 800555555 Major: Computer Science 6) Once your program compiles without errors and you run it for the first time, you will see that you are unable to enter your street address. The program skips to the prompt for city. This occurs because nextInt() does not capture the new line and skips the next scanner code. To fix the problem, clear the buffer by using nextLine() immediately after each nextInt(). System.out.println("Enter your street number"); streetNumber = myObj.nextInt(); // Read user input myobj.nextLine(); Part B: Add Javadoc to code A cellphone service provider has three different subscription packages. Plan A: $29.95 per month 3GB of data provided. Additional data $10 per 1GB data Plan B: $49.95 per month 5GB of data provided. Additional data $8 per 1GB data Plan C: $69.95 per month with unlimited data provided. 1) Write a method cellphoneCost() that accomplishes the following requirements: It should prompt the user to enter the letter of the package the customer purchased (A, B or C) and the amount of data that was used. Calculate and display the total charges Calculate and display the amount of money Plan A customers would save if they purchased Plans B or C Calculate and display the amount of money Plan B customers would save if they purchased Plan If there are no savings, display a message that the customer has the most cost-efficient plan. 2) Add Java doc comments at the top of your cellPhoneCost () method. They should include A summary that describes the purpose of the method @author specifies the author of the method @param lists and describes each of the parameters in the parameter list (if any). @return describes the information that is returned to the calling statement (if any). 3) In NetBeans you can right-click the Src icon, click Tools, then click Analyze Javadoc. This will tell you if you need to add more information. 4) When you are done, generate the Javadoc. Check the method summary and the method details to ensure your comments were put into the Java Documentation correctly. Part C: Square Display 1) Write a method that prompts the user for a positive integer no greater than 15. The method should verify that a positive integer no greater than 15 was entered. It should then display a square on the screen using the character "X". The number entered will be the length of each side of the square. For example, if the user enter 5, the display should look like the following: XXXXX XXXXX XXXXX XXXXX XXXXX 2) Add a Javadoc for the method. 3) Upload your.java files to the Lab2 Submission in Canvas. Part D: Add HTML to Javadocs (extra credit) 1) Add inline documentation on confusing sections of code. 2) Spruce up your javadocs with html tags (p, ul & li, b, i, h3, etc...) Instructions Part A: Declare, set, and print fields. Part B: Document some code (that you have to code) Part C: Display a square of X's based on user input (add documentation) Lab 2: User Input & Documentation Criteria Ratings Pts Instance Variables (Fields) Instance variables declared, set from user input, and displayed: all fields 5pts, gets user input 5pts, sets fields 5pts, displays output 5pts, accuracy 5pts 25 to >0.0 pts Full Marks O pts No Marks 25 pts 50 to >0.0 pts Full Marks O pts No Marks Javadoc on cell provider method Write a method cellphoneCost with java documentation: gets user input 5pts, calculates and displays charges 5pts, savings (if any) 5pts, rates accurate 5pts, javadoc /** 10pts meaningful description 10pts javatags 10pts 50 pts Square Display Write a method that displays a square of X's no greater than 15: gets user input 5pts, 1-15 verification 10pts, displays a square 5pts, displays X's 5pts 25 to >0.0 pts Full Marks O pts No Marks 25 pts Beautiful Javadocs (extra credit) HTML added to javadocs to a professional level. 10pts. (looks like https://bit.ly/367EJOILinks e to an external site.) O pts No Marks 10 to >5.0 pts Professional Documentation Similar to what you would find in an oracle documentation 5 to >0.0 pts Added HTML tags or Meaningful Documentation The program is easy to read and understand, based on the documentation 10 ptsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started