Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

How to create a flowchart for this qestion.

flowchart pseudocode programming

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 BeckBeishen

BeckBeishen

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 09 June 2015 - 12:58 PM

The Problem: You have a file that contains records of vehicles; your supervisor wants a count of the different vehicles found on the file and the percentage ratio of each.

 

There is a code on each record that indicates the type of vehicle, the codes are:

A = automobile

T = trucks

B = buses

M = motorcycles

O = other

 

The output should be a count for each type of vehicle and the percentage of the total. Example: automobiles: 25 14% Trucks 30 15%

 

I have no idea where to start it. This is all new for me, I just started taking programming classes so please if you could explain it to me step by step instead of just putting up the answer I would appreciate it very much. 

I don't know the total number of cars in the records or how many of each different types of vehicles there are in the records. I am very confused. Please help!!



#2 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts

Posted 09 June 2015 - 01:40 PM

Explaining step by step would be giving you the psuedocode.

 

The idea is you open the file, read line by line, and check code. You also have counters for each type of vehicle and the total. Depending on the code, you increment (add 1) to the counter for that code, as well as for the total.

 

Once you finish processing the file, you output (code_count/total)*100 for each code counter.


Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download