Last active
July 13, 2017 16:28
-
-
Save vmasullo/f4e482332a7ccfff7e36aa4a54bb0037 to your computer and use it in GitHub Desktop.
Reportcard java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.android.reportcard; | |
/** | |
* Created by Enzo on the 12/07/2017. | |
*/ | |
public class ReportCard { | |
/** | |
* The variables are the subjects and the approved grades | |
*/ | |
private final int SUBJETS = 8; | |
private final int PASSED_GRADE = 6; | |
/** | |
* Name | |
* Udacity school | |
* <p> | |
* Those are the subjects given to the Udacity students : | |
* Quiz app, | |
* Score app, | |
* Report card, | |
* Music app, | |
* Tour guide app, | |
* Book app, | |
* News app. | |
*/ | |
private String mName; | |
private String mUdacity; | |
private int mQuiz_app; | |
private int mScore_app; | |
private int mReport_card_; | |
private int mMusic_app; | |
private int mGuide_app; | |
private int mBook_app; | |
private int mNews_app; | |
private int mPASSED_GRADE; | |
* | |
* @parameters name name of student | |
* @parameters Udacity Udacity | |
* @parameters Quiz_app Quiz_app grade | |
* @parameters Score_app Score_app grade | |
* @parameters Report_card Report_card grade | |
* @parameters Music_app Music app grade | |
* @parameters guide_app Guide app grade | |
* @parameters Book_app Book app grade | |
* @parameters News_app News app | |
*/ | |
public ReportCard(String name, String Udacity, | |
int Quiz_app, int Score_app, | |
int Report_card_ , int Music_app, | |
int guide_app, int Book_app , | |
int News_app { | |
int addingUp = 0; | |
mName = name; | |
mUdacity = Udacity; | |
mQuiz_app = Quiz_app; | |
mScore_app = Score_app; | |
mReport_card_ = Report_card_; | |
mMusic_app = Music_app; | |
mguide_app = guide_app; | |
mBook_app = Book_app; | |
mNews_app = News_app; | |
// Calculation on how to reach the average grade | |
addingUp = mQuiz_app + | |
mScore_app + | |
mReport_card_ + | |
mMusic_app + | |
mguide_app + | |
mBook_app + | |
mNews_app; | |
mAverageGrade = addingUp / SUBJETS; | |
} | |
public void setName(String username) { | |
mName = username; | |
} | |
public void setUdacity(String school) { | |
mUdacity = school; | |
} | |
public void setQuiz_app(int grade) { | |
mQuiz_app = grade; | |
} | |
public void setScore_app(int grade) { | |
mScore_app = grade; | |
} | |
public void setReport_card_(int grade) { | |
mReport_card_ = grade; | |
} | |
public void setMusic_app(int grade) { | |
mMusic_app = grade; | |
} | |
public void setguide_app(int grade) { | |
mguide_app = grade; | |
} | |
public void setBook_app(int grade) { | |
mBook_app = grade; | |
} | |
public void setNews_app(int grade) {mNews_app = grade; | |
} | |
public String getName() { | |
return mName; | |
} | |
public String getUdacity() { | |
return mUdacity; | |
} | |
public int getQuiz_app() { | |
return mQuiz_app; | |
} | |
public int getScore_app() {return mScore_app;} | |
public int getReport_card_() {return mReport_card_;} | |
public int getMusic_app() { | |
return mMusic_app; | |
} | |
public int getguide_app() { | |
return mguide_app; | |
} | |
public int getBook_app() { | |
return mBook_app; | |
} | |
public int getNews_app() { | |
return mNews_app; | |
} | |
public int getAverageGrade() { | |
return mAverageGrade; | |
} | |
@Override | |
public String toString() { | |
int totalPASSED_GRADE = 0; | |
String message; | |
message = mName + "\n" + | |
mUdacity + "\n"; | |
message += "\nQuiz_app: " + mQuiz_app; | |
if (mQuiz_app >= PASSED_GRADE) { | |
message += " PASSED"; | |
totalPASSED_GRADE++; | |
} | |
message += "\nScore_app: " + mScore_app; | |
if (mScore_app >= PASSED_GRADE) { | |
message += " PASSED"; | |
totalPASSED_GRADE++; | |
} | |
message += "\nReport_card: " + mReport_card; | |
if (mReport_card >= PASSED_GRADE) { | |
message += " PASSED"; | |
totalPASSED_GRADE++; | |
} | |
message += "\nMusic_app: " + mMusic_app; | |
if (mMusic_app >= PASSED_GRADE) { | |
message += " PASSED"; | |
totalPASSED_GRADE++; | |
} | |
message += "\nguide_app: " + mguide_app; | |
if (mguide_app >= PASSED_GRADE) { | |
message += " PASSED"; | |
totalPASSED_GRADE++; | |
} | |
message += "\nBook_app : " + mBook_app; | |
if (mAstronomy >= PASSED_GRADE) { | |
message += " PASSED"; | |
totalPASSED_GRADE++; | |
} | |
message += "\nNews_app: " + mNews_app; | |
if (mNews_app >= PASSED_GRADE) { | |
message += " PASSED"; | |
totalPASSED_GRADE++; | |
} | |
message += "\n\n Subjects Passed = " + totalPASSED_GRADE + "\n\nPASSED_GRADE = " + mPASSED_GRADE; | |
return message; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment