Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please make it simple: Chapter 11, Programming Challenge #1 (p.651) Write a program that uses a structure named MovieData to store the following information about

Please make it simple:

Chapter 11, Programming Challenge #1 (p.651)

Write a program that uses a structure named MovieData to store the following information about a movie:

Title

Director

Year Released

Runtime (in minutes)

The program should create two MovieData variables, store values in their members, and pass each one, in turn, to a function that displays the information about the movie in a clearly formatted manner.

Notes:

Title and Director should be strings, name them title and director

Year Released and Runtime should be integers, name them yearReleased and runtime

No input needed from the user

Initialize one variable initialization list, and the other by setting each member

Name the function that displays the contents of a movieData variable displayMovie

It should take a single constant movieData reference as its parameter

You can use whatever values for the movie data you wish; I care about how you are storing the data in this program.

Sample Output:

Title : War of the Worlds

Director : Byron Haskin

Released : 1953

Running Time: 88 minutes

Title : War of the Worlds

Director : Stephen Spielberg

Released : 2005

Running Time: 118 minutes

Press any key to continue . . .

...............................................................................................................................................................

Chapter 11, Programming Challenge #6 (p.652)

Write a program that stores the following data about a soccer player in a structure:

Players Name

Players Number

Points scored by Player

The program should keep an array of 12 of these structures. Each element is for a different player on a team. When the program runs, it should ask the user to enter the data for each player. It should then show a table that lists each players number, name, and points scored. The program should also calculate and display the total points earned by the team. The number and name of the player who are earned the most points should also be displayed.

Notes:

Name your structure player

Create a function that gathers the information for a player from the user

Create a function that displays a player structure for the table

Sample Output:

PLAYER

---------

Player's name: Ella

Player's number: 23

Points scored: 53

PLAYER

---------

Player's name: John

Player's number: 13

Points scored: 32

PLAYER

---------

Player's name: James

Player's number: 42

Points scored: 13

PLAYER

---------

Player's name: Frankie

Player's number: 82

Points scored: 14

PLAYER

---------

Player's name: Lindsey

Player's number: 84

Points scored: 24

PLAYER

---------

Player's name: Gabriel

Player's number: 46

Points scored: 24

PLAYER

---------

Player's name: Ruth

Player's number: 62

Points scored: 34

PLAYER

---------

Player's name: Fred

Player's number: 73

Points scored: 9

PLAYER

---------

Player's name: Molly

Player's number: 47

Points scored: 32

PLAYER

---------

Player's name: Nick

Player's number: 99

Points scored: 11

PLAYER

---------

Player's name: Karen

Player's number: 96

Points scored: 23

PLAYER

---------

Player's name: Terry

Player's number: 44

Points scored: 6

NAME NUMBER PTS SCRD

Ella 23 53

John 13 32

James 42 13

Frankie 82 14

Lindsey 84 24

Gabriel 46 24

Ruth 62 34

Fred 73 9

Molly 47 32

Nick 99 11

Karen 96 23

Terry 44 6

TOTAL POINTS: 275

The player who scored the most points is: Ella

Press any key to continue . . .

..............................................................................................................................................

Program #3

Chapter 11, Programming Challenge #15 (p.656)

Write a program that calculates pay for either an hourly paid worker or a salaried worker. Hourly paid workers are paid their hourly pay rate times the number of hours worked. Salaried workers are paid their regular salary plus any bonus they may have earned. The program should declare two structures for the following data:

Hourly Paid

HoursWorked

HourlyRate

Bonus

The program should also declare a union with two members. Each member should be a structure variable: one for the hourly paid worker and another for the salaried worker. The union should be part of another structure that also contains a flag for what portion of the union should be used. (If you have questions about this part, please email the instructor)

The program should ask the user whether he or she is calculating the pay for an hourly paid worker or a salaried worker. Regardless of which the user selects, the appropriate members of the union will be used to store the data that will be used to calculate the pay.

Use the following flow structure and functions:

Function: Main Askes user if salaried or hourly. Calls appropriate function based on answer to gather information about the worker. Main should receive a worker pointer back. Main then calls the print function for the worker.

Function: getHourly Asks the user for the hourly rate and number of hours worked, storing the answers in a new worker object, which it returns

Function getSalaried Asks the user for the salary and bonus for a worker, storing the answers in a new worker object, which it returns

Function printWorker takes a worker object, and prints out a report for the information about the worker, including the gross pay (which would be calculated)

Note:

Input validation not required, but would be no negative numbers, and no values greater than 80 for hours worked.

Your two structures must be named hourly and salaried, the union should be named worker

Accept both capital and lowercase letters for selecting what type of worker from the user

Sample Output:

(H)ourly or (S)alaried? S

Enter the salary amount: 23058

Enter the bonus amount: 3802

Salaried Worker

Salary: $23058.00

Bonus: $3802.00

----------

Gross Pay: $26860.00

Press any key to continue . . .

====================================

(H)ourly or (S)alaried? H

Enter the number of hours worked: 39

Enter the hourly pay rate: 14.83

Hourly Worker

Hours: 39

Rate: $14.83

----------

Gross Pay: $578.37

Press any key to continue . . .

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions