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

Programming Concepts - 1D 2D

Uploaded by

vihanga.ya09
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Programming Concepts - 1D 2D

Uploaded by

vihanga.ya09
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Programming Concepts – 1D & 2D arrays

1. Write a pseudocode to store full name of each student at school the admission process. Full

name will contain First name, Middle Name and Last Name. Prompt messages to input each

name separately and store in a 2D array studentname[]. Assume school will get register 60

students per year. Student ID used as the index of the 2D array (starting from 1100 to 1160)

Output full name of the students.

2. A data logger records the temperature on the roof of a school every hour. Input and store the

temperatures recorded for a month in a 2D array named dailytemp[]. Assume that there are

30days in a month. Decide your own validation rules and validate all the temperatures on

entry and any invalid temperatures are rejected.

• Calculate the average daily temperature and store in another1D array avgtemp.

• Output monthly average.

Your program must include appropriate prompts for the entry of data.

3. Input and store the names and marks for 30 students who have sat three computer science

tests. Test 1 is out of 20 marks, Test 2 is out of 25 marks, Test 3 is out of 35 marks. You must

store the names in a one-dimensional array and the marks and total score for each student in

one-dimensional arrays. All the marks must be validated on entry and any invalid marks

rejected. You may assume that the students’ names are unique.

Calculate and store the total score for each student and calculate the average score for the

whole class. Output each student’s name followed by their total score, then output the

average score for the class.

Select the student with the highest score and output their name and score.
4. Names of students are stored in the one-dimensional (1D) array Student [] of type string. A

separate two-dimensional (2D) array Data [] stores the latest data recorded about each

student. The array already contains the readings taken by a teacher for each student:

• weight

• height measured to one decimal place

The StudentID given to the student is used for the index on both arrays, this is a value between

1 and 50 inclusive.

The data of students is used to calculate the BMI (BMI = (height*height)/weight). According to

the BMI value, suitable message will be displayed.

➢ Underweight = BMI less than 18.5

➢ Normal weight = BMI should be within the range of 18.5 to 24.9 (inclusive)

➢ Overweight = BMI should be 25 to 29.9 (inclusive)

➢ Obesity - BMI 30 or greater.

Write a procedure, using pseudocode or program code, to output the Student Name, BMI value

and relevant message.

Niranjala Pasqual - 0717408026


BSc in IT

You might also like