statement. This version of your program must use only c-strings (include cstring) and must not use the string class (do not include string)
Part 2, The String Class Read the names into a 1D array of string objects with each row in parallel with the corresponding row in the sales array. Perform the same calculations as before but display the names of the firework types at the beginning of each row of output. In addition, add a function that creates an Intro Message for your program. Run it to print the message before the rest of your output. It should use the string class functions to build a list of the fireworks that are offered. You MUST use and += to build the message and then print it with one cout statement. This version of your program must use only the string class (include string) and must not use c- strings (do not include cstring)
Both Programs Both programs must be modular. Use separate functions for input, each part of the processing and output. Your output should be well-organized, neat, and easy to read. Design each of your programs by completing the CS 250 Program Design Document. You may use a separate document for each program or put both designs into the same document. Include a structure chart, prototype and brief description for each function and time estimates for program design, coding each function, program testing, and total time. If you put both designs in the same file, you may use one structuré chart, if you like. arid Save the designs in files named FireworksDesignCstring_xxx.doc Fireworks DesignString_xxx.doc or just Fireworks Design_xxx.doc if using one file, where xxx are your initials. Submit your design file(s) in the Program #4 Design drop box by the due date shown in the calendar. Write both programs. I recommend writing the c-string version first as it generally takes more time. Save it, make a copy and update the copy to be the string version. Save your c-string program in a file named fireworks_cstring_xxx.cpp where xxx are your initials. Save your string program in a file named fireworks_string_class_xxx.cpp where xxx are your initials. Compile, run, test, and debug both programs. Update your Program Design Documents. Update the structure chart & function descriptions to fit your working program. Record the actual time spent. Submit your updated design documents and working .cpp files in the Program #4 drop box by the due date shown in the calendar. You should submit a total of 2 .cpp files in this drop box and 1 or 2 .doc files.
Fireworks Program - updated Update your Fireworks program (Program 2) to allow the user to read both the names and sales data for each of the 5 types of fireworks. The names may contain embedded white space and are stored into the fireworks2.txt data file as shown below. A test data file is posted in D2L. Bottle Rocket 856.43 386.54 785.34 1043.60 1534.87 2544.66 Dahlia 1247.50 290.54 506.80 899.65 1440.65 3006.99 Crackle Effect 629.65 337.99 290.88 Jumping Jacks 792.65 689.54 Palm Tree 698.54 699.54 345.67 784.21 987.65 1024.35 852.49 1735.90 1024.28 2905.76 2956.87 1743.98 3278.54 You will write 2 programs for this assignment. The first must use c-style strings (character arrays), as discussed in our book to implement your solution. The second will solve the same problem using the string class instead of c-style strings. I recommend writing the c-string implementation first, then making a copy of it and updating the copy to use the string class. Part 1, C-Style Strings Read the names into a 2D array of characters (1D array of C-strings) with each row in parallel with the corresponding row in the sales array. Perform the same calculations as before but display the names of the firework types at the beginning of each row of output In addition, add a function that creates an Intro Message for your program. Run it to print the message before the rest of your output. It should use the c-string processing functions to build a list of the fireworks that are offered. You MUST use strcpy and strcat to build the message and then print it with one cout Fireworks Program - updated Update your Fireworks program (Program 2) to allow the user to read both the names and sales
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am