| | |
Prog and Logic Question for beginner
Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2004
Posts: 2
Reputation:
Solved Threads: 0
I am a beginning Prog Logic and Design student. I have a project to write pseudocode and draw a flow chart to do the following. From an Alumni File I have the following fields
Alumnus Number
Alumnus Name
Year Graduated
Major
I want to get all Alumni With a Major in Bus, who graduated from 1984 and then print the total of the Alumni listed, then create a flow chart showing how to do this.
I have started it like this:
Start
If Major ="Bus" then
If Year Graduated ="1984" then
Printf "Alumnus Number","Alumnus Name"
Else End Then
Get calculated total of "Alumus Name"
Printf Numeric Total "Alumnus Name"
Stop
Is this correct? I am not sure what to do if the answer is No to the first 2 conditions. Can someone help me? I think I can flowchart it okay if I can just get this part of it.
Thank you!
Alumnus Number
Alumnus Name
Year Graduated
Major
I want to get all Alumni With a Major in Bus, who graduated from 1984 and then print the total of the Alumni listed, then create a flow chart showing how to do this.
I have started it like this:
Start
If Major ="Bus" then
If Year Graduated ="1984" then
Printf "Alumnus Number","Alumnus Name"
Else End Then
Get calculated total of "Alumus Name"
Printf Numeric Total "Alumnus Name"
Stop
Is this correct? I am not sure what to do if the answer is No to the first 2 conditions. Can someone help me? I think I can flowchart it okay if I can just get this part of it.
Thank you!
•
•
Join Date: Oct 2005
Posts: 33
Reputation:
Solved Threads: 1
Can anyone give me some suggestions.
This is what I have so far.
Logic Problem:
You run a retail store and you have decided to step through your inventory one record at a time and put everything on sale. For each item in your inventory you want to print out the sale price for 4 days. The first day of the sale you mark the items down 10%, the next day you mark them down another 10% based on the previous sale price. The third day of the sale, you mark them down another 10% based on the previous sale price. The fourth day of the sale, you mark them down another 10% based on the previous sale price.
Draw the logic flowchart or write the pseudocode to solve this problem. Your flowchart or pseudocode should be complete. That means start with the mainline and include housekeeping, processing and wrapup.
START:
Perform HouseKeeping()
While not eof
Perform mainloop()
Endwhile
Perform wrapup()
Stop
HouseKeeping()
Declare variables
Open Inventory
Open Printer
Read Inventory
Return
Main Loop
SalesPriceDay1 = RetailPrice – 10%
SalesPriceDay2 = SalesPriceDay1 – 10%
SalesPriceDay3 = SalesPriceDay2 – 10%
SalesPriceDay4 = SalesPriceDay3 – 10%
While not eof
Print SalesPriceDay1
Print SalesPriceDay2
Print SalesPriceDay3
Print SalesPriceDay4
Endwhile
Read Inventory
This is what I have so far.
Logic Problem:
You run a retail store and you have decided to step through your inventory one record at a time and put everything on sale. For each item in your inventory you want to print out the sale price for 4 days. The first day of the sale you mark the items down 10%, the next day you mark them down another 10% based on the previous sale price. The third day of the sale, you mark them down another 10% based on the previous sale price. The fourth day of the sale, you mark them down another 10% based on the previous sale price.
Draw the logic flowchart or write the pseudocode to solve this problem. Your flowchart or pseudocode should be complete. That means start with the mainline and include housekeeping, processing and wrapup.
START:
Perform HouseKeeping()
While not eof
Perform mainloop()
Endwhile
Perform wrapup()
Stop
HouseKeeping()
Declare variables
Open Inventory
Open Printer
Read Inventory
Return
Main Loop
SalesPriceDay1 = RetailPrice – 10%
SalesPriceDay2 = SalesPriceDay1 – 10%
SalesPriceDay3 = SalesPriceDay2 – 10%
SalesPriceDay4 = SalesPriceDay3 – 10%
While not eof
Print SalesPriceDay1
Print SalesPriceDay2
Print SalesPriceDay3
Print SalesPriceDay4
Endwhile
Read Inventory
•
•
Join Date: Mar 2008
Posts: 26
Reputation:
Solved Threads: 0
Hi,
I just posted a question and I saw yours, so I wanted to share my 2cents worth of ideas with you.
To answer the question what to do if the answer is No to the first 2 conditions.
Well lets take it step by step if the answer is No to the first condition that is Major != "Bus" then you will need to skip it and go on to the next record. You need alums with major = "Bus" and nothing else.
same thing goes for the 2nd condition, if it is not equal to 1984 even though major = "Bus" you toss it out and go on to the next record.
Until you reach the end of the Alumni File, you keep searching for these two conditions. Once you reach the end of the file, well you are done them.
I also suggest to keep the count each time you find a record, so after the line:
Printf "Alumnus Number","Alumnus Name"
You would increment the counter by 1 say using something like
counter++ or ++counter
I hope this helps...
I just posted a question and I saw yours, so I wanted to share my 2cents worth of ideas with you.
To answer the question what to do if the answer is No to the first 2 conditions.
Well lets take it step by step if the answer is No to the first condition that is Major != "Bus" then you will need to skip it and go on to the next record. You need alums with major = "Bus" and nothing else.
same thing goes for the 2nd condition, if it is not equal to 1984 even though major = "Bus" you toss it out and go on to the next record.
Until you reach the end of the Alumni File, you keep searching for these two conditions. Once you reach the end of the file, well you are done them.
I also suggest to keep the count each time you find a record, so after the line:
Printf "Alumnus Number","Alumnus Name"
You would increment the counter by 1 say using something like
counter++ or ++counter
I hope this helps...
•
•
•
•
I am a beginning Prog Logic and Design student. I have a project to write pseudocode and draw a flow chart to do the following. From an Alumni File I have the following fields
Alumnus Number
Alumnus Name
Year Graduated
Major
I want to get all Alumni With a Major in Bus, who graduated from 1984 and then print the total of the Alumni listed, then create a flow chart showing how to do this.
I have started it like this:
Start
If Major ="Bus" then
If Year Graduated ="1984" then
Printf "Alumnus Number","Alumnus Name"
Else End Then
Get calculated total of "Alumus Name"
Printf Numeric Total "Alumnus Name"
Stop
Is this correct? I am not sure what to do if the answer is No to the first 2 conditions. Can someone help me? I think I can flowchart it okay if I can just get this part of it.
Thank you!
![]() |
Similar Threads
Other Threads in the Legacy and Other Languages Forum
- Previous Thread: Miranda
- Next Thread: dimensioning using matlab
| Thread Tools | Search this Thread |





