How long a human user can assign dish duties among children

Assignment Help Computer Engineering
Reference no: EM132210194

Question :

Write a program in java that determines how long a human user can assign dish duties among the children in a family before making a mistake. Use Console I/O (Scanner and System.out) for all input/output. Follow the directions carefully and be particularly careful to write methods when directed, instead of stuffing main() with code that should be elsewhere.

Write a method that takes user input to create a list of the names of the children in the family. This method must be able to create a list of any number of names, including zero. You can ask the user first for the number of children, and then use a for loop to take that number of names from input and add them to the list, but there are several other possible approaches. This method must return a reference to the list. Do not give the list class scope.

In main(), write a loop that calls the method described above, keeping a reference to the list it returns, and then offers a menu with three options: Quit, Hard Problem, and Easy Problem. The user must be able to repeat this exercise as many times as he or she wants to, providing a new list of names each time, and the program must not terminate until the user chooses to quit.

Implement the hard and easy problems in separate methods, not inside main(). Each of these methods will take a List of Strings as its only parameter and return an int.

In the main loop, use a switch based on the user's input to call the method that corresponds to the user's choice of hard or easy problem. Send a reference to the List of names in the method call.

Within the method for each problem, use a loop that increments the day by one for each iteration, and use a modulo operation to determine which child is responsible for dish duties each day. The Three Stooges example in the review lecture may be helpful. Get the name using the index and List's get(int index) method.

For the easy problem, construct Strings that contain the day number (starting with 0) and the name of the child who should do the dishes.

For day 0, the String should be similar to "Day 0: Bob must do the dishes." For the hard problem, just get the name of the child who is responsible for the dishes on each day.

For the easy problem, output the correct String and require the user to copy the whole String back at the console prompt.

For the hard problem, just provide the prompt "input: " and test whether the String input by the user is identical to the name of the child.

For each iteration of the loop, test the input to see if it matches the correct answer. Use a boolean variable that is set to true if the input is correct and set to false when the user makes an error. The loop test should fail when the value of this boolean is false. Don't use a break() statement for this.

The method should return an int, which represents the number of times the user provided the correct input. Print this result form to the main.

Reference no: EM132210194

Questions Cloud

Write a program to implement the 56-bit des algorithm : Write a program to implement the 56-bit DES algorithm (in ECB model). Use your program with your chosen key to encrypt a message of 80 bytes.
Display all items in the list and sorted by reference number : Display all items in the list, sorted by reference number. Display all items in the list, sorted by priority level.
Key management theory-principle milestones over time : Based on your readings and research, develop a timeline if key management theory/principle milestones over time
Create a business plan for the organization : Create a business plan for this organization to enter a global market in which they are not already doing business (see section 2 of Table 8.1).
How long a human user can assign dish duties among children : Write a program in java that determines how long a human user can assign dish duties among the children in a family before making a mistake.
Explain supply chain operations reference model : Explain the supply chain operations reference (SCOR) model of the construction company. Ensure that a diagram is included to support your explanation.
Converts base 10 numbers to any given base : The program should have a gui with an input box and two buttons, one button to convert any base between 2 and 16 to base 10;
Create a null and alternate hypothesis to test sales : Imagine that a company wants to test whether it is a better idea to assign each sales representative to a defined territory or allow him or her to work without.
Managing people who are managing customer experiences : How is managing people making things different from managing people who are managing customer experiences?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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