Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
# DART-HACKATHON-REPOSITORY


# Dart Programs



## Program 1: Display Personal Information
Write a Dart program using variables to display your name, age, school, and a hobby. Print it in one logical sentence.
Wrote a Dart program using variables to display my name, age, school, and a hobby. Print it in one logical sentence.

## Program 2: Perform Mathematical Operations with Functions
Write a Dart program that performs two mathematical operations using functions.
- Was to write Dart program that performs two mathematical operations using functions.
- added some more math operations to enhance user experience

## Program 3: Determine Grade Based on Marks
Write a Dart program to determine the grade based on a student's marks. The program should print out the appropriate grade according to the following criteria:
- If the marks are greater than 85, print "Excellent".
- If the marks are between 75 and 85 (inclusive), print "Very Good".
- If the marks are between 65 and 75 (inclusive), print "Good".
- If the marks are below 65, print "Average".
Wrote a Dart program to determine the grade based on a student's marks. The program should print out the appropriate grade according to the following criteria:
## I added the feature that the program should calcute the grade base on the average marks
- If the average marks greater than 85, print "Excellent".
- If the average marks between 75 and 85 (inclusive), print "Very Good".
- If the average marks between 65 and 75 (inclusive), print "Good".
- If the average marks are below 65, print "Average".

## Feature
- The program ask for user to input marks for 3 subjects
- the average is auto calculated and the student is graded by the system

### technology used
- Dart
52 changes: 46 additions & 6 deletions controlflow.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,47 @@
// Program 3: Determine Grade Based on Marks
// Write a Dart program to determine the grade based on a student's marks. The program should print out the appropriate grade according to the following criteria:
// - If the marks are greater than 85, print "Excellent".
// - If the marks are between 75 and 85 (inclusive), print "Very Good".
// - If the marks are between 65 and 75 (inclusive), print "Good".
// - If the marks are below 65, print "Average".
import 'dart:io';
class studentGradingSystem{

## Program 3: Determine Grade Based on Marks
Write a Dart program to determine the grade based on a student's marks. The program should print out the appropriate grade according to the following criteria:
- If the marks are greater than 85, print "Excellent".
- If the marks are between 75 and 85 (inclusive), print "Very Good".
- If the marks are between 65 and 75 (inclusive), print "Good".
- If the marks are below 65, print "Average".
int english;
int maths ;
int science;
studentGradingSystem(this.english, this.maths, this.science);
String grade(){
int marks = (this.english + this.maths + this.science);
num Average = marks / 3;

if(Average >= 85){
return "Excellent";
}
else if(Average >= 75 && maths >= 85){
return "Very Good";
}
else if(Average >= 65 && maths >= 75){
return "Good";
}
else if(Average < 65 && maths >= 65){
return "Average";
}
else{
return "Fail";
}
}
}
void main(){
print("********Welcome to the student grading system************");
print("Please enter your English language marks: ");
int english = int.parse(stdin.readLineSync()!);
print("Please enter your Maths marks: ");
int maths = int.parse(stdin.readLineSync()!);
print("Please enter your Science marks: ");
int science = int.parse(stdin.readLineSync()!);
studentGradingSystem student = studentGradingSystem(english, maths, science);
String grade1 = student.grade();
print("Your grade is: $grade1");

}
56 changes: 54 additions & 2 deletions functions.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,54 @@
## Program 2: Perform Mathematical Operations with Functions
Write a Dart program that performs two mathematical operations using functions.
// Program 2: Perform Mathematical Operations with Functions
//Write a Dart program that performs two mathematical operations using functions.
import 'dart:io';

class MathematicsProgram{
int number1;
int number2;

MathematicsProgram(this.number1, this.number2);
int add(){
int result = number1 + number2;
return result;
}
int subtract(){
return number1 - number2;
}
int multiply(){
return number1 * number2;
}
num divide(){
return number1 / number2;
}
}
void main(){
//ask the user to enter two numbers
print("Enter the first number: ");

int num1 = int.parse(stdin.readLineSync()!);
print("Enter the second number: ");
int num2 = int.parse(stdin.readLineSync()!);

MathematicsProgram mp = MathematicsProgram(num1, num2);
print("Choose your operation: \n1. Add\n2. Subtract\n3. Multiply\n4. Divide\n");

int choice = int.parse(stdin.readLineSync()!);
switch(choice){
case 1:
print(mp.add());
break;
case 2:
print(mp.subtract());
break;
case 3:
print(mp.multiply());
break;
case 4:
print(mp.divide());
break;
default:
print("Invalid choice");
break;
}

}
10 changes: 8 additions & 2 deletions program1..dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
## Program 1: Display Personal Information
Write a Dart program using variables to display your name, age, school, and a hobby. Print it in one logical sentence.
// Program 1: Display Personal Information
void main(){
String name = "David";
int age = 22;
String school = 'Zetech University';
String hobby = 'Listening to music on Spotify';
print("My name is $name, I am $age years old, I live in $school and I like $hobby.");
}