Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: You will be using conditional statements and loops to create a basic adoption program for dogs. Example code is provided at the bottom. Requirements:

Objective: You will be using conditional statements and loops to create a basic adoption program for dogs. Example code is provided at the bottom.

Requirements:

  • The first part of the program will require user input that indicates whether the user will adopt based off of a certain amount of dogs or based off of a budget.
  • If the user enters 1, then they will be prompted to enter the amount of dogs they would like to adopt.
  • If the user enters 2, then they will be prompted to enter their budget amount (integer).
  • For both options 1 and 2, a menu will be prompted asking if the user would like a small dog ($25), medium dog($40), or a large dog($65) by inputting 1, 2, or 3 respectively.
    • If the user had chosen a certain amount of dogs to adopt, then the user will be able to choose either sizes until they reach their chosen amount. The program will then output the total price they paid for the amount of dogs they originally specified to adopt.
    • If the user had chosen a budget, then the user will be able to buy until they can no longer buy the cheapest dog or they decide to quit. The program will then output the amount of dogs purchased and their remaining budget (even if it is $0).

Additional Notes:*

  • When prompted for an input for an option, we will only enter in numbers within that range. EX) We won't enter in 10 when only options 1 and 2 are present.
  • You will be using both for- and while-loops.
  • While using the budget option, if the amount entered or if the remaining budget is less than $25, then the loops should end. Also, users should be outputted an error when trying to adopt a dog that is higher than their current budget.

Example:

Please select an adoption process: 1) Adoption by animal amount 2) Adoption by budget **1** Enter the amount of animals you are adopting: **2** Which dog would you like to adopt? 1) Small dog ($25) 2) Medium dog ($40) 3) Large dog ($65) **1** You have chosen a small dog for $25! Which dog would you like to adopt? 1) Small dog ($25) 2) Medium dog ($40) 3) Large dog ($65) **3** You have chosen a large dog for $65! Your final total is $90 for 2 dog(s). 
Please select an adoption process: 1) Adoption by animal amount 2) Adoption by budget **2** Enter your adoption budget: $**50** Which dog would you like to adopt? 1) Small dog ($25) 2) Medium dog ($40) 3) Large dog ($65) 4) Quit **3** Sorry but you cannot afford that option. Enter your adoption budget: $**50** Which dog would you like to adopt? 1) Small dog ($25) 2) Medium dog ($40) 3) Large dog ($65) 4) Quit **2** You have chosen a medium dog for $40! You have bought 1 dog(s) with $10 remaining. 

C++ please

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

what is a peer Group? Importance?

Answered: 1 week ago

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago