Question
You are developing a Fraction structure for Teachers Pet Software. The structure contains three public data fields for whole number, numerator, and denominator. Using the
You are developing a Fraction structure for Teachers Pet Software. The structure contains three public data fields for whole number, numerator, and denominator. Using the same structure, write the functions described below: An enterFractionValue()function that declares a local Fraction object and prompts the user to enter values for the Fraction. Do not allow the user to enter a value of 0 for the denominator of any Fraction; continue to prompt the user for a denominator value until a valid one is entered. The function returns a data-filled Fraction object to the calling function. A reduceFraction()function that accepts a Fraction object and reduces it to proper form, returning the reduced Fraction. For example, a Fraction entering the function as 0 2/6 would be reduced to 0 1/3, and a Fraction entered as 4 18/4 would be reduced to 8 1/2. A displayFraction()function that displays any Fraction object passed to it. This function displays a fraction with a slash between the numerator and denominator. A main()function that declares a Fraction object and continues to get Fraction values from the user until the user enters a Fraction with value 0 (both the whole number and the numerator are 0). For each Fraction entered, display the Fraction, reduce the Fraction, and display the Fraction again.
Q.13 Write a program that allows users to enter a dollar amount for their bank account balance
at the beginning of the month. Then ask the user to enter dollar amounts for any
number of checks written in a month, up to 50. Include an appropriate sentinel value
that the user can enter to stop entering checks. Store the amounts in an array and count
the entries as the user makes them. Finally, ask the user to enter a monthly interest rate
if the account is interest bearing, or a 0 if it is not. If the user enters 0 for the interest rate,
then call a function named balanceAccount()that accepts the beginning balance, the
number of checks, and the array of check amounts as parameters; the function displays
the final balance after all the checks have been subtracted from the beginning balance.
If the user enters a number other than 0 for the interest rate, then call an overloaded
function named balanceAccount()that accepts the beginning balance, the number
of checks, the array of check amounts, and the interest rate as parameters. This function
then computes the final balance by subtracting all the checks from the beginning balance
and using the monthly interest rate to increase the final balance before displaying it. Save
the file as BankCalculations.cpp.
Q17. Create a structure named Shirt that has the public data members collarSize and
sleeveLength. Create a structure named Pants that has the public data members
waistSize and inSeam. Write a program that declares one object of each type Shirt
and Pants and assigns values to the objects data fields. Write two overloaded functions
named displayClothingFacts(). One version of the function takes a Shirt object as
a parameter; the other version takes a Pants object. Each version displays the facts about
the piece of clothing. Your main()function should demonstrate that you can call
displayClothingFacts()with either type of clothing. Save the file as Shirt.cpp.
Please can the file be worked using #include< iostream >.
Please leave comment so i can follow what you did and how you did it
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started