Question Details

Answered: - Instructions: In this assignment you get to work further with C++


Need help on attached. Due tomorrow ?night at midnight.


Instructions: In this assignment you get to work further with C++ user-defined functions, file

 

I/O, and arrays ? and each problem requires you to define and use a recursive function.

 

Remember that this is an individual assignment; you are to complete it on your own with no

 

help from others or other sources (e.g., similar examples on the Internet). Also, remember to

 

follow all the assignment instructions.

 

One of the most common uses of computers is for data processing ? and the examples this week

 

feature searching through a file for a value and simple numerical computation. Both operations

 

are used in a wide variety of data processing programs.

 


 

Problem A) Finding the Lexicographically Largest Name in a List of Names

 

Write a program that reads a list of one word names into an array and then uses a recursive

 

function called lexLargest to search the array for the lexicographically larger name, and

 

return it. (Note, you are to define and implement the function lexLargest). Your program

 

should print the lexicographically largest name in the array to the console.

 

Note that String B is lexicographically larger than String A if String B would be listed after

 

String A in a dictionary.

 

For example:

 

?aab? > ?aaa?

 

?dan? > ?Dan?

 

?aaaa? > ?aaa?

 

You can assume there is at least one name in the input file, and you should create your own files

 

to test your program. The maximum length of each name is100 characters, the maximum

 

number of names in the file is 100, and you can use cstrings or strings for this assignment. Your

 

program should include a continuation loop to ask the user if they wish to continue, and check

 

for errors upon opening and closing files. An example run of the program is as follows:

 

Assume that the file names1.dat contains the following names:

 

Bob

 

Bill

 

Amy

 

Alphonso

 

1

 


 

Enter file name: names1.dat

 

The lexicographically largest name is: Bob

 

Would you like to continue? (Enter Y or N): N

 


 

Problem B) Making Change

 

Create a recursive function that accepts an integer as a parameter containing a value between 1

 

and 99. The recursive function should print out the set of coins that add up to the value assigned

 

to the parameter using the least number of coins. You should embed the recursive function in a

 

program that ensures that the user correctly enters a number between 1 and 99. If the user fails

 

to enter a number between 1 and 99, your program should print out an error and re-prompt the

 

user until they successfully enter a number between 1 and 99. Your program should also include

 

a continuation loop. An example run of the program is as follows:

 

Enter Amount of Change required (in cents): 99

 

Your change consists of:

 


 

1

 

1

 

1

 

1

 

1

 

4

 


 

Quarter

 

Quarter

 

Quarter

 

Dime

 

Dime

 

Cents

 


 

Would you like to continue? (Enter Y or N): Y

 

Enter Amount of Change required (in cents): 100

 

Error: 100 is not a valid number of cents for this program, Enter a

 

value between 1 and 99.

 

Enter Amount of Change required (in cents): 5

 

Your change consists of:

 

1 Nickle

 

Would you like to continue? (Enter Y or N): N

 

NOTE: cent = 1 cent, nickel = 5 cents, dime = 10 cents, quarter = 25

 

cents. A half dollar is not used in this problem.

 


 

2

 


 

3

 


 

 


Solution details:

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Oct 07, 2020

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN A DEADLINE.

Order Now