An'evergreen' School:  Jss1 Records

An'evergreen' School: Jss1 Records

Working with student's records

The principal of the Evergreen was highly impressed by the previous solution, and now requests that I build a new solution, that will make the work of the registrar easier. But starting with JSS1 students. He requires these: To be able to upload all the student's names, date of birth, height, state of origin. They should be able to view this data.

CLASS OF STUDENTS AND DATA REGISTRAR IS TO BE PROMPTED TO ENTER IN SOLUTION APP

JSS1 STUDENTS

  1. Student's names
  2. Date of Birth
  3. Height
  4. State of Origin

STEPS TO BUILDING THE SOLUTION APP

STEP 1

IMPORTING NECESSARY LIBRARIES

import 'dart:io';
import 'dart:core';

STEP 2

DECLARING THE VARIABLES

  final String name = stdin.readLineSync()!;
  final String dateOfBirth = stdin.readLineSync()!;
  final int height = int.parse(stdin.readLineSync()!);
  final String stateOfOrigin = stdin.readLineSync()!;

STEP 3

PROMPTING REGISTRAR TO INPUT STUDENT'S DATA

  print("Welcome! This is the database for JSS1 Students. Please kindly enter 
  student's name.");
  print("Please enter student's date of birth.");
  print("Please enter student's height in centimeters.");
  print("Please enter the student's State of origin.");

STEP 4

EXPERIMENTING WITH MAP IN DARTS

var Pupil = {
    "name" : name,
    "dateOfBirth" : dateOfBirth,
    "height" : height,
    "stateOfOrigin" : stateOfOrigin,
  };
  JSS1STUDENTS.add(Pupil);

STEP 5

THE LOGIC: USING THE WHILE... AND IF ... ELSE STATEMENT

while(true) {
      print("Enter 1 to proceed or enter 0 to terminate.");
    final int candidateInput = int.parse(stdin.readLineSync()!);
      if(candidateInput == 1){
        addPupil();
      }else if(candidateInput == 0){
        print(JSS1STUDENTS);
        break;
      }else{
        print("Invalid input");
      }
    }

REFERENCE

Credit to: YouTube videos, Canva