Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ The crossed out parts I already did. I did it by adding to a vector the name of the contestant by however many times

C++

image text in transcribed

The crossed out parts I already did. I did it by adding to a vector the name of the contestant by however many times they purchased a ticket. Example, say Tracy bought 3, the vector has Tracy's name 3 times. Then Marco bought 2, the vector now has Tracy's name 3 times and Marco's 2 times. Then I drew random index number to declare the winner. Ther is a variable to count how many contestants I have, in above example it is 2.

Part two I need help with. Thank you!

My vector example so you know my syntax: vector Name; Name.at(i); Name.push_back(Purchaser); //where purchaser variable is the cin from user input..... ect.

Part 1: (50 points) You are creating a program for a raffle. The each ticket for the raffle costs 5 dollars to enter, and contestants may purchase a ticket as many times as they like. When entries for the raffle are closed, one winning ticket is selected at random. The winner gets 75% of the entry fees as a prize, and the company running the raffle keeps the remaining 25%. Your solution should have the following requirements: e program w user to enter a new nam e program will prompt the user to e nter "Q" to finish selling tick ets The progra m will randomly select a winne he progran Il display the total number of participants, the name of the winner, and the prize Assume each name is unique and keep names one word (no spaces). Before moving on to part 2, ensure you have part 1 working and completed. Part 2: (20 points-10 bonus points) Extend the raffle program by adding the ability to view statistics about the entries. Display the names of each entry and the percent chance of them winning the raffle before determining the winner. Assuming no two people have the same name, determine how many tickets were purchased by each person, and divide that number by the total number of tickets to determine the percent chance of winning. Part 1: (50 points) You are creating a program for a raffle. The each ticket for the raffle costs 5 dollars to enter, and contestants may purchase a ticket as many times as they like. When entries for the raffle are closed, one winning ticket is selected at random. The winner gets 75% of the entry fees as a prize, and the company running the raffle keeps the remaining 25%. Your solution should have the following requirements: e program w user to enter a new nam e program will prompt the user to e nter "Q" to finish selling tick ets The progra m will randomly select a winne he progran Il display the total number of participants, the name of the winner, and the prize Assume each name is unique and keep names one word (no spaces). Before moving on to part 2, ensure you have part 1 working and completed. Part 2: (20 points-10 bonus points) Extend the raffle program by adding the ability to view statistics about the entries. Display the names of each entry and the percent chance of them winning the raffle before determining the winner. Assuming no two people have the same name, determine how many tickets were purchased by each person, and divide that number by the total number of tickets to determine the percent chance of winning

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_2

Step: 3

blur-text-image_3

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

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

3. A scholarship-holders base.

Answered: 1 week ago

Question

Select suitable tools to analyze service problems.

Answered: 1 week ago