Demonstrate understanding of arithmetic operations

Assignment Help Computer Engineering
Reference no: EM131576971

By completing this project, you will demonstrate your understanding of:

1) Arithmetic operations (addition, subtraction, multiplication, division, modulus)

2) Conditional statements (If, If-Else, If-ElseIf-Else, Conditional Operator, Switch)

3) Precondition, postcondition, and indexing loops (Do-While, While, For)

4) Standard text file operations (open, close, read, write)

5) Modularizing code by breaking into functions (including functions with input parameters, and ones that return a specific data type)

There is a number guessing game similar to MasterMind called Pico-Fermi-Bagel. In this game, the leader chooses a 3-digit number that must not contain individual digits that are the same, and must be a 3-digit number. (In other words, 999 is not ok (3 digits, but the digits repeat), 25 is not ok (2 digits - cannot lead off with a zero), 121 is not ok either (3 digits, but 2 of the digits are the same).) The leader does not reveal the number to the players. The players must guess the number. If the players guess no digits in the number, that is called a "Bagel" - because bagels look like zeros. If a guess contains one or more digits that are in the number, but not in the right placevalue, then each of those is a "Pico" - pico means little, and the answer is a "little right". If the guess contains one or more digits that are in the number AND in the right placevalue, then each of those is a "Fermi" - Fermi was a famous scientist; look it up.

Example. The leader picks 451

Player guess 1: 120 - this is a Pico because the 1 is in the actual number, but in the wrong place value.

Player guess 2: 879 - this is a Bagel because none of the digits are in the number (we like bagels, they tell us a lot!)

Player guess 3: 615 - This is a PicoPico (the 1 and the 5 are in the final number, but in the wrong places).

Player guess 4: 541 - this is a PicoPicoFermi (the 1 is in the correct place, the 4 and 5 are in the number but in the wrong places. Now we know the answer on the next guess.

The project: Create a version of PicoFermiBagel.

- Your code must include a function that picks the 3-digit number, and a function that checks the user input.

- You must write a text file with the original number in it, and then all the user should enter a number to guess and the computer responses between pico, fermi, bagel from each of guesses. You must ask the user for the name of the file to save. So, given the example above, the text file would look something like this:

451

120: Pico

879: Bagel

615: Pico Pico

541: Pico Pico Fermi

451: Fermi Fermi Fermi

- Your code must have a function that checks for valid input (a positive 3-digit number input), and asks the user again for input if the number is not valid.

- Your code needs to have a way for the user to "quit" the game.

- Your code needs to have a way for the user to play again without restarting the program. In this case, the new game information should be added at the end of the file you have created.

Reference no: EM131576971

Questions Cloud

Research paper on illegal drugs : Research paper on illegal drugs, prostitution and money laundering. discusses illegal drug use, illegal prostitution and money laundering.
What information does my audience need about the topic : Who is the audience, What information does my audience need about the topic
Define sorting algorithms in terms of the complexity : Compare and contrast some of the most important sorting algorithms in terms of their complexity and when they are used. Define all types of the sorting.
Perfect competition in the real world : What are some of the characteristics of perfect competition? Which types of industries come closest to perfect competition in the real world?
Demonstrate understanding of arithmetic operations : Write a text file with the original number in it, and then all the user should enter a number to guess and the computer responses between pico, fermi
Describe some of the sources of law : Please describe some of the sources of law / factors that may be relevant in considering whether this proposed law should be enacted?
Why is the shut-down price and quantity : Why is the shut-down price and quantity found at the lowest part of the AVC (average variable cost) curve?
Effect of government expenditure and government purchases : what is the effect of government expenditure and government purchases on GDP?
Describe the search techniques used by the crawlers : Describe the search techniques used by the crawlers and spiders in different search engines on the Web.

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