0% found this document useful (0 votes)
10 views

Program Design Assignment

The document outlines an assignment for a Mechatronics Engineering course, requiring the design of a program in C to assign grades based on student scores. It includes a flowchart and pseudo-code for a simple vending machine, detailing the steps for user interaction and item dispensing. The provided code and flowchart illustrate the logic for both tasks effectively.

Uploaded by

jasminekadiri07
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Program Design Assignment

The document outlines an assignment for a Mechatronics Engineering course, requiring the design of a program in C to assign grades based on student scores. It includes a flowchart and pseudo-code for a simple vending machine, detailing the steps for user interaction and item dispensing. The provided code and flowchart illustrate the logic for both tasks effectively.

Uploaded by

jasminekadiri07
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

NAME:ONECHOJON BLESSING

MATRIC NUMBER: 2022/11420


DEPARTMENT: MECHATRONICS ENGINEERING
COURSE CODE:CEN 301
COURSE TITLE:SOFTWARE DEVELOPMNT TECHNIQUE
ASSIGNMENT
1. Design a program that accepts a student score and assign a grade based o the
following criterion:
Score>= 90, Grade A
Score>= 80, Grade B
Score>= 70, Grade C
Score>= 60, Grade D
Score< 60, Grade F
2. Design a flowchart and pseudo-code for a simple vending machine
SOLUTION
1. The code for the grade assignment will be written in C language:
#include <stdio.h>

int main() {
int score;
char grade;
printf(“Enter the Student’s score: );
scanf(“%d”, &score);
if (score >=90) {
grade = “A”;}
else if (score >=80) {
grade = “B”;}
else if (score >=70) {
grade = “C”;}
else if (score >=60) {
grade = “D”;}
else {
grade = “F”;}
printf(“The Students’s grade is: %c\n”, grade);
return 0;
}

2. FLOWCHART FOR THE VENDING MACHINE

START
PSEUDOCODE FOR THE VENDING MACHINE
Start

Display available items and their corresponding prices

Prompt user to insert money

Accept input as “money”

While money is not sufficient, display insufficient funds

Prompt user to select an item

Dispence the item

End
Display:
Items and
Price

Insert Money

Is Money
sufficient?

NO YES

Display:
Insufficient Dispense Item
Funds

STOP

You might also like