Identify all of the lines of code within the program

Assignment Help JAVA Programming
Reference no: EM13810402

Assignment 1 - Development of a Simple Menu Driven Program

Part A - Code Comprehension

Your task is to first answer some questions testing your comprehension of the partial solution. Use the sample code provided in StarterCode.java to answer the following questions. Include the answers in your assignment submission.

1. The code provided does not contain any comments.

a. Briefly explain why comments are important in code.

b. Update the code provided to include comments - include a copy of the commented code starter code in your assignment submission.

2. Identify all of the lines of code within the program that are associated with obtaining user input. This can be done by either copying the lines into your answers or highlighting the lines within the code.

3. The variable finished should be used as the condition for the while loop.

a. Briefly explain the purpose of the variable finished.

b. What value will it have when the while loop is initially entered?

4. Run the program. When the menu is presented enter 2 as the selected item.

a. What is the output of the program to the console? Why are all the values 0?

b. Briefly explain how would you should alter the code below so that it displays an appropriate prompt, rather than "Enter Response 1" for each loop:

case 1: System.out.println("Menu selection 1");
for(int i=0;i<surveyResponses.length;i++){
System.out.println("Enter Response 1");

5. Identify the lines that would need to be altered so that the menu is controlled by a do-while loop rather than the while- loop and provide the new lines of code required

6. Currently a switch-statement is used within the program to handle the different menu options. What other program structure could have been used?

7. Run the program.

a. use the following table to test the code provided:

b. Briefly outline the changes would you would need to make to the program so that it handles the menu entries correctly and exits the program when the user enters menu selection 4. Note: You do not need to make the changes in the code for Part A.

8. With the program an array has been used to store the data. Currently the code has two lines declaring the array, one that has been commented out.

a. Briefly explain both of the lines of code used to declare arrays.

b. Briefly explain why the programmer would include the declaration that has been commented out.

Part B - Program Analysis, Implementation and Development

It is suggested that you design, implement and test each of detailed below in order - completing each section completely and correctly before proceeding to the next. For each stage, with the exception of stage 1, you should:

1. design a solution in the form of pseudo-code to carry out the required task - include this pseudo-code as part of your project documentation, clearly indicating which stage it belongs to;

2. perform a desk check of your logic - if you find any problems with your pseudo-code you should redesign and retest;

3. implement the stage - update the code so that it implements the algorithm you have designed - at the end of each stage listed below save a copy of the code that has been developed and name each file appropriately;

4. test the stage - ensure that before moving onto the next stage of development that the program works and that there are no logic or runtime errors

Your code should use appropriate programming standards and be well documented/commented. You are permitted to discuss the sample program with your peers in order to understand it. However, you must ensure that you complete this section individually. It is expected that no two students will have the same program.

Part C - Testing

You should be testing your program as each stage is completed, and again once the program is complete. You should document the testing data, process and results (e.g. in the form of a table) and include this within your project documentation. Your mark for this section will reflect the thoroughness of your testing and the quality of your documentation.

Attachment:- Assignment.zip

Reference no: EM13810402

Questions Cloud

Dividend growth models to estimate the cost of equity : S. Company has the following capital structure: 45% debt, 15% preferred stock and 40% common stock. Assume the risk-free rate is 8%, the beta stock is 1.3 and the market risk premium (Rm - Rf) is 12%, Determine the weighted average costs of capital (..
Explain how to use the security market line to select stocks : Explain how to use the Security Market Line to select stocks. Explain the significance of the risk-free rate and the market risk premium.
The canterbury tales : The Canterbury Tales
Explain why NPV is preferred over IRR : Explain why NPV is preferred over IRR if there is a conflict between the two methods in the selection of projects
Identify all of the lines of code within the program : Identify all of the lines of code within the program that are associated with obtaining user input. This can be done by either copying the lines into your answers or highlighting the lines within the code.
Replace an existing assembly with a more modern version : The Cement Corp is planning to replace an existing assembly with a more modern version. the old equipment was purchased 5 years ago for $500,000 and depreciated to a zero value over the 5 years. If the cost of capital is 16% and the tax rate is 40%, ..
Complete a roadmap of the current it projects : Using the case provided, build on Part 1 of your IT Strategic Plan. Develop IT strategies to align to the business strategies, complete a roadmap of the current IT projects, propose a new IT project to support the IT strategies, identify risks ass..
Expected rate of return of both stocks using dividend growth : What are the required rates of returns on both stocks using the CAPM model? What are the expected rates of return of both stocks using the dividend growth model. Which stock would you recommend to purchase or sell? Why?
Address the issue of database conversion : In addition, you need to address the issue of database conversion. Once they implement your database, how does your client enter the data they already have?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write jvm program which accepts rpn expression

Write down the IJVM program which accepts RPN expression, with each operand and operator entered line by line. As each number (operand) is entered, push it on stack.

  Sets a loop to find 10 random generated

Write a java code that 1) uploads a file 2) sets a loop to find 10 random generated words from the file and then search those words by a. IndexSequential Method b. indexBinary Method. then, report how much time both methods took.

  Writing a program that computes the average salary

The first programming project involves writing a program that computes the average salary for a collection of employees of different types. This program consists of four classes

  Mean and standard deviation using using eclipse

Java programming to calculate Mean and standard deviation using Using Eclipse.

  Implement the hashcode method

Java, every object has an equals and a hashCode method that is used, among other things, by the standard Collections library. By default both are based on an object's memory location

  Addressed with attributable risk

Which of the following questions is addressed with attributable risk?

  How to apply filter in servlet

Can you do this assignment please help int this how to apply filter in servlet create 3 class and show the filter chaining phenomenon..... Show the working program thanks.............

  Compare swing java gui components to awt components

Compare Swing Java GUI components to AWT components. Explain at least one way the components are similar and at least one way they are different.

  Displays the number of days in a month

Create a program that displays the number of days in a month. Use a 12-element one-dimensional array to store the number of days in each month (use 28 for the number of days in February).

  Strong authentication can also risk availability

Strong authentication can also risk availability. A simple example is that forgetting your password denies you access to that which required a password. Sometimes the stakes are high, for example, if a network administrator is the only one who knows ..

  Program should assign a seat in the first class

If a person enters 1, your program should assign a seat in the first class (rows 1 - 3). If a person enters 2, your program should assign a seat in business class (rows 4 - 7). If a person enters 3, your program should assign a seat in economy class ..

  Class to initialize values

Create a constructor that allows a user of the class to initialize values. Also create a method named SetJustSold()(Hint ++) that increments the number of hot dogs the stand has sold by one and should also increase the TotalSold by one

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd