In: Computer Science
I need a Flowchart for the above psuedocode. Thank You?
Above pseudocode is in OOP concept :
A class Car is defined having 1 constructor and 3 methods :
Constructor is parameterized to set the values of variables , as variables are not shown in program we are not aware of names for same .
Contructor have 3 parameters which sets the values of data members inside Car class.
Constructor name is same as that of Class name.
Syntax:
Car()
Three methods are also declared:
1. getSpeed ()
2. accelerate ()
3. brake()
All are public methods , accessible outside the class , as well , " + " symbol is used to show the methods are public
Main function in the program to execute the program
Firstly, object of class Car is declared
Constructor is called to initialize/set the values
accelarate() function of class Car is called five times
And speed() function is called five times in the print statement to print speed value
This is done by FOR loop by giving initializing variable i to 0 ,condition i<5 and incremented i by 1
After that, brake() function of class Car is called five times
And speed() function is called five times in the print statement to print speed value
This is done by FOR loop by giving initializing variable i to 0 ,condition i<5 and incremented i by 1
Functions of class is called by declaring object for that class and dot operator with function name
Class diagram for Class Car:
Flowchart of main function with comments:
Note: Flowchart for functions of class is not constructed as details are not mentioned in the question