Celutron Smartphones, a smartphone store needs to determine if it should open a
ID: 3701929 • Letter: C
Question
Celutron Smartphones, a smartphone store needs to determine if it should open a new location based on the sales at its two stores. One is located at Maryland, and the other one is located at Washington DC. Each smartphone’s store only sells the same five types of cellphones (e.g. iPhones, Samsungs, etc.). First, your program will allow the user to enter the types of cellphones the stores sells. Next, the program must allow the user to repeatedly enter sale records for cellphones that have been sold, one record at the time. Until the user has indicated he or she is finished. Each sale record contains only one type of cellphones and the store location of the sale. IMPORTANT, for entering the types of cellphones and the store locations, the user must only be allowed to enter thy type of cellphones and store location, and not a number representing the type of cellphones or store location. When the user finish of entering all sale records the program needs to print a report containing a list of each type of cellphones to be sold by the store, the number of cellphones of each type sold by each location, and the total number of cars sold across all the store locations. Lastly, the report must display which store location sold the most cellphones.
(Your solution must demonstrate the concept of one-dimentional arrays.)
(Your solution must not use methods other than main.)
Solution Design:
a) Create a defining diagram that shows the input, the processing, and the output.
b) A list of control structures required.
c) Create a solution algorithm using pseudocode.
d) Show testing using the desk check of the algorithm.
Explanation / Answer
A.a
Use a switch case with the condition of store name in the condition statement à Thereafter use another switch statement , that contains the name of the Cellular phone as the iteration condition and initialize the count as ++ , everytime the condition comes true with the input of the sales professional mentioned in the requirement.
switch( condition of location satisfied)
enters the second switch statement (condition of phone satisified)
sales professional makes the entry and the count is incremented.
A.b
List of Controls
Switch statement , that is case sensitive , and has condition to fulfill , through the sales professional entry , first that of location , followed by the switch statement of the phone name.
A.c
Switch (location name1)
{
switch (phone name 1 )
{
string arr[10]=name;
float cash arr1[5]=money;
string location2[10]=location;
count++;
}
switch (phone name 2 )
{
count++;
}
switch (phone name 3 )
{
count1++;
}
same algorithm for store 2 and corresponding cellphones and so on;
The main program runs to initialize the phone name 1, phone name 2…. And location parameters for each entry to be specified .
In the main program
print the location1<< count++…count1++ , to display the count of cellular phones sold in each store and add them all in store sum to sum up the total cellphones saled by a store.
Thus chose 5 different sum variables and print them respectively for the final by a test condition
when the user enters switch(0), the sum program is initialized and run.
So in totality the program has 6 switch statements , 5 count variables and 5 sum variables and 6 conditions , where one condition of switch (0) , is the termination statement.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.