id
stringlengths
36
36
text
stringlengths
1
1.25M
441fe0a8-3f15-434f-ac9b-d6209728b30c
@Test public void testEditLatestInput() throws Exception { model.addData("2"); model.addData("+"); model.addData("3"); model.editLatestInput("5"); assertEquals("5", model.getLastInput()); assertEquals(3, model.getSequence().size()); }
c661a3f3-774e-46ec-9094-94027aa07bf7
@Test public void modificationSomeContact() throws Exception { app.getNavigationHelper().openMainPage(); // save old state List<ContactData> oldList = app.getContactHelper().getContacts(); app.getContactHelper().selectContactByIndex(2); ContactData Contact = new ContactData(); Contact.firstname = "new first name 3"; Contact.daybirthday = "17"; Contact.monthbirthday = "May"; Contact.homesecondarytel = "1"; app.getContactHelper().fillContactFormWithoutGroup(Contact); app.getContactHelper().submitContactModification(); app.getNavigationHelper().gotoHomePage(); // save new state List<ContactData> newList = app.getContactHelper().getContacts(); // compare states oldList.remove(0); oldList.add(0,Contact); Collections.sort(oldList); Collections.sort(newList); assertEquals(newList, oldList); }
f79e2141-14ef-4b67-a358-ccfc27ebd0f8
public GroupData() { }
a4d5c64d-d429-46a8-8722-fef68abef292
public GroupData(String name, String header, String footer) { this.name = name; this.header = header; this.footer = footer; }
ff01328a-7c18-4152-b185-21c4b77fba39
@Override public String toString() { return "GroupData [name=" + name + ", header=" + header + ", footer=" + footer + "]"; }
bf60ba3b-2579-4528-8a75-8cf44ad0aa73
@Override public int hashCode() { final int prime = 31; int result = 1; //result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; }
0d197efa-a5ab-4015-8af7-fb2d1fd4e82b
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; GroupData other = (GroupData) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; }
d4d9604a-5e33-4742-b3e0-ce50da3c477b
@Override public int compareTo(GroupData other) { return this.name.toLowerCase().compareTo(other.name.toLowerCase()); }
0d7d68a1-b38a-46cc-ac1a-65c2e1ddd81d
public ContactData() { }
fe39a120-7d67-4585-9d7b-80866a704d73
public ContactData(String firstname, String lastname, String address, String hometel, String mobiletel, String worktel, String email1, String email2, String daybirthday, String monthbirthday, String yearbirthday, String group, String addresssecondary, String homesecondarytel) { this.firstname = firstname; this.lastname = lastname; this.address = address; this.hometel = hometel; this.mobiletel = mobiletel; this.worktel = worktel; this.email1 = email1; this.email2 = email2; this.daybirthday = daybirthday; this.monthbirthday = monthbirthday; this.yearbirthday = yearbirthday; this.group = group; this.addresssecondary = addresssecondary; this.homesecondarytel = homesecondarytel; }
6cb38d7e-89a1-4905-87dd-35a1fed44c6f
@Override public String toString() { return "ContactData [firstname=" + firstname + "]"; }
de9556f1-9352-4225-ba84-c61c71d92986
@Override public int hashCode() { final int prime = 31; int result = 1; //result = prime * result // + ((firstname == null) ? 0 : firstname.hashCode()); return result; }
56c9bc5b-d51f-4894-aaba-1fa2c02ed222
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ContactData other = (ContactData) obj; if (firstname == null) { if (other.firstname != null) return false; } else if (!firstname.equals(other.firstname)) return false; return true; }
863bb0f4-9e11-418f-9fbe-7b08e0b6ae31
@Override public int compareTo(ContactData other) { return this.firstname.toUpperCase().compareTo(other.firstname.toUpperCase()); }
569af028-da57-47b3-a1a0-12d8c8de5c95
@Test(dataProvider = "randomValidGroupsGeneration") public void modificationSomeGroup(GroupData group) { app.getNavigationHelper().openMainPage(); app.getNavigationHelper().gotoGroupsPage(); // save old state List<GroupData> oldList = app.getGroupHelper().getGroups(); Random rnd = new Random (); int index = rnd.nextInt(oldList.size()-1); // actions app.getGroupHelper().initGroupModification(index); app.getGroupHelper().fillGroupForm(group); app.getGroupHelper().submitGroupModification(); app.getNavigationHelper().gotoGroupsPage(); // save new state List<GroupData> newList = app.getGroupHelper().getGroups(); // compare states oldList.remove(index); oldList.add(group); Collections.sort(oldList); assertEquals(newList, oldList); app.getNavigationHelper().gotoHomePage(); }
4f83e44d-553c-449f-b177-cbcbcfaa1800
@Test(dataProvider = "randomValidGroupsGeneration") public void testGroupCreationwithValidData(GroupData group) throws Exception { app.getNavigationHelper().openMainPage(); app.getNavigationHelper().gotoGroupsPage(); // save old state List<GroupData> oldList = app.getGroupHelper().getGroups(); // actions app.getGroupHelper().initGroupCreation(); app.getGroupHelper().fillGroupForm(group); app.getGroupHelper().submitGroupCreation(); app.getNavigationHelper().gotoGroupsPage(); // save new state List<GroupData> newList = app.getGroupHelper().getGroups(); // compare states oldList.add(group); Collections.sort(oldList); assertEquals(newList, oldList); app.getNavigationHelper().gotoHomePage(); }
479f401a-288c-4d09-8281-04c39e240323
@Test public void deleteSomeContact() { app.getNavigationHelper().openMainPage(); // save old state List<ContactData> oldList = app.getContactHelper().getContacts(); app.getContactHelper().selectContactByIndex(2); app.getContactHelper().submitDeleteContact(); app.getNavigationHelper().gotoHomePage(); // save new state List<ContactData> newList = app.getContactHelper().getContacts(); // compare states oldList.remove(0); Collections.sort(newList); Collections.sort(oldList); assertEquals(newList, oldList); }
52c69ebe-4218-463d-80db-4ab14617cccb
@Test(dataProvider = "randomValidContactsGeneration") public void testNonEmptyContactCreation(ContactData contact) throws Exception { app.getNavigationHelper().openMainPage(); // save old state List<ContactData> oldList = app.getContactHelper().getContacts(); app.getNavigationHelper().openNewContactPage(); app.getContactHelper().fillContactForm(contact); app.getContactHelper().submitContactCreation(); app.getNavigationHelper().openHomePage(); // save new state List<ContactData> newList = app.getContactHelper().getContacts(); // compare states oldList.add(contact); Collections.sort(newList); Collections.sort(oldList); assertEquals(newList, oldList); }
75e5b624-9bda-4945-8f9b-0215c367230a
@BeforeTest public void setUp() throws Exception { app = new ApplicationManager(); }
4fed4958-3d68-4f33-9f8d-1a4e66bfe3a2
@AfterTest public void tearDown() throws Exception { app.stop(); }
c10949f2-df54-4c46-9472-7f40cf7ad17d
@DataProvider public Iterator<Object[]> randomValidGroupsGeneration () { List<Object[]> list = new ArrayList<Object[]>(); for (int i = 0; i < 5; i++ ){ GroupData group = new GroupData(); group.name = generaateRandomString(); group.header= generaateRandomString(); group.footer= generaateRandomString(); list.add(new Object [] {group}); } return list.iterator(); }
6d231774-6856-480d-a9db-f89a54cb8db1
@DataProvider public Iterator<Object[]> randomValidContactsGeneration () { List<Object[]> list = new ArrayList<Object[]>(); for (int i = 0; i < 5; i++ ){ ContactData contact = new ContactData(); contact.firstname = generaateRandomString(); contact.lastname = generaateRandomString(); contact.address = generaateRandomString(); contact.hometel = generaateRandomString(); contact.mobiletel = generaateRandomString(); contact.worktel = generaateRandomString(); contact.email1 = generaateRandomString(); contact.email2 = generaateRandomString(); contact.daybirthday = generateRandomElementFromList(1); contact.monthbirthday = generateRandomElementFromList(2); contact.yearbirthday = generaateRandomString(); contact.group = generateRandomElementFromList(3); contact.addresssecondary = generaateRandomString(); contact.homesecondarytel = generaateRandomString(); list.add(new Object [] {contact}); } return list.iterator(); }
707c4770-f6fd-439d-9156-edac477dd2a5
public String generaateRandomString () { Random rnd = new Random (); if (rnd.nextInt(3)== 0){ return ""; }else{ return "test" + rnd.nextInt() ; } }
fe9ca76f-449f-4d71-a033-89330284e7b4
protected String generateRandomElementFromList(int element) { List<String> webElementsNames = app.getContactHelper().getWebElementsTextList(element); Random rnd = new Random(); return webElementsNames.get(rnd.nextInt(webElementsNames.size())); }
a9b090be-821b-4fd1-aa48-81cdabcd501e
@Test public void deleteSomeGroup() { app.getNavigationHelper().openMainPage(); app.getNavigationHelper().gotoGroupsPage(); // save old state List<GroupData> oldList = app.getGroupHelper().getGroups(); Random rnd = new Random (); int index = rnd.nextInt(oldList.size()-1); // actions app.getGroupHelper().deleteGroup(index); app.getNavigationHelper().gotoGroupsPage(); // save new state List<GroupData> newList = app.getGroupHelper().getGroups(); // compare states oldList.remove(index); Collections.sort(oldList); assertEquals(newList, oldList); app.getNavigationHelper().gotoHomePage(); }
b9abef0f-4fde-4aa1-8208-b777f1153615
public ApplicationManager() { driver = new FirefoxDriver(); baseUrl = "http://localhost/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); contactHelper = new ContactHelper(this); }
aae33546-0656-4c4f-b14a-81050eeaf3e6
public void stop() { driver.quit(); }
d24e0514-a5f9-4434-90fb-b6f897a07b7f
public NavigationHelper getNavigationHelper() { if (navigationHelper == null) { navigationHelper = new NavigationHelper(this); } return navigationHelper; }
778a33d8-f16c-4514-8104-6945382da827
public GroupHelper getGroupHelper() { if (groupHelper == null) { groupHelper = new GroupHelper(this); } return groupHelper; }
f6ac2c6b-5d44-4796-9f1c-80ad173dd77c
public ContactHelper getContactHelper() { if (contactHelper == null) { contactHelper = new ContactHelper(this); } return contactHelper; }
cf9824e9-b591-4b57-abcc-e622bd3cfba8
public NavigationHelper(ApplicationManager manager) { super(manager); }
ee9fd4f2-c496-4998-85dc-4debef6713eb
public void openMainPage() { driver.get(manager.baseUrl + "/addressbookv4.1.4/"); }
8a9a8e6c-3d57-46ad-a188-55eb24e9e1d4
public void gotoHomePage() { click(By.linkText("home")); }
af0bf18a-7998-4016-bfb0-2bbf68fa8198
public void openHomePage() { click(By.linkText("home")); }
86773626-5b38-44ba-ab4e-52a95de28e81
public void gotoGroupsPage() { click(By.linkText("groups")); }
51c0dccd-bc83-4b2c-9d25-465955b82aa1
public void openNewContactPage() { click(By.linkText("add new")); }
78c4c9c4-81cd-48ee-85b0-6f2dec7c4803
public ContactHelper(ApplicationManager manager) { super(manager); }
a071c5a3-5869-4f96-835b-f739132a1048
public void submitContactCreation() { click(By.name("submit")); }
e722a55d-5f0b-4040-93d4-5cad4b871949
public void fillContactForm(ContactData contact) { type(By.name("firstname"), contact.firstname); type(By.name("lastname"), contact.lastname); type(By.name("address"), contact.address); type(By.name("home"), contact.hometel); type(By.name("mobile"), contact.mobiletel); type(By.name("work"), contact.worktel); type(By.name("email"), contact.email1); type(By.name("email2"), contact.email2); selectByText(By.name("bday"), contact.daybirthday); selectByText(By.name("bmonth"), contact.monthbirthday); type(By.name("byear"), contact.yearbirthday); selectByText(By.name("new_group"), contact.group); type(By.name("address2"), contact.addresssecondary); type(By.name("phone2"), contact.homesecondarytel); }
68edc31b-e7a0-417c-94ad-e93fcc5bb1c6
public void fillContactFormWithoutGroup(ContactData contact) { type(By.name("firstname"), contact.firstname); type(By.name("lastname"), contact.lastname); type(By.name("address"), contact.address); type(By.name("home"), contact.hometel); type(By.name("mobile"), contact.mobiletel); type(By.name("work"), contact.worktel); type(By.name("email"), contact.email1); type(By.name("email2"), contact.email2); selectByText(By.name("bday"), contact.daybirthday); selectByText(By.name("bmonth"), contact.monthbirthday); type(By.name("byear"), contact.yearbirthday); type(By.name("address2"), contact.addresssecondary); type(By.name("phone2"), contact.homesecondarytel); }
67fd7932-77ad-4eb3-8876-bf5265287364
public void selectContactByIndex(int index) { click(By.xpath("//tr[" + index + "]//td[1]")); click(By.xpath("//tr[" + index + "]//td[7]")); }
877d1a87-7389-4726-894b-734c54381a9d
public void submitDeleteContact() { click(By.xpath("//input[@value='Delete']")); }
da002b8f-f84b-4600-834b-8fed796e4216
public void submitContactModification() { click(By.xpath("//input[@value='Update']")); }
5ba740e4-e27b-400d-b729-c9abbf3a9c7c
public List<ContactData> getContacts() { List<ContactData> contacts = new ArrayList<ContactData>(); List<WebElement> fields = driver.findElements(By.xpath("//table//tr [@class='odd' or @class='even' ]//td[3]")); for (WebElement field : fields) { ContactData contact = new ContactData(); String td = field.getText(); contact.firstname=td; contacts.add(contact); } return contacts; }
69767690-221c-4155-bd6f-89969c6110b0
public List<String> getWebElementsTextList(int element) { String xpath = ""; if (element==1) { xpath = bDayXpath; }{if (element==2){ xpath = bMonthXpath;}{ xpath = groupXpath;} } List<String> rArray = new ArrayList<String>(); List<WebElement> webElems = driver.findElements(By.xpath(xpath)); for (WebElement webElem : webElems) { String webElemText = webElem.getText(); rArray.add(webElemText); } return rArray; }
6429c61f-eba2-4175-8ef3-efbc9344535c
public GroupHelper(ApplicationManager manager) { super(manager); }
b225b5d0-0bcc-49fe-a538-ab9825df8f2f
public void initGroupCreation() { click(By.name("new")); }
86f825dc-e74e-4659-8f9e-68acacbfde56
public void fillGroupForm(GroupData group) { type(By.name("group_name"), group.name); type(By.name("group_header"), group.header); type(By.name("group_footer"), group.footer); }
ecf7274d-a0ac-471d-9d05-89451fa0da86
public void submitGroupCreation() { click(By.name("submit")); }
55275c3b-d6da-40d9-babe-6db1214efbfe
public void deleteGroup(int index) { selectGroupByIndex(index); click(By.name("delete")); }
5c43505f-30bc-45f3-93a4-5805dff50b4b
private void selectGroupByIndex(int index) { click(By.xpath("//input[@name='selected[]'][" + (index+1) + "]")); }
94233027-e65a-4acf-a34b-7e92e3b278c3
public void initGroupModification(int index) { selectGroupByIndex(index); click(By.name("edit")); }
327cfcb7-8d66-465e-be3b-326feb17689f
public void submitGroupModification() { click(By.name("update")); }
d0347632-4001-426e-84a8-57126ccf57e8
public List<GroupData> getGroups() { List<GroupData> groups = new ArrayList<GroupData>(); List<WebElement> checkboxes = driver.findElements(By.name("selected[]")); for (WebElement checkbox : checkboxes) { GroupData group = new GroupData(); String title = checkbox.getAttribute("title"); group.name=title.substring("Select (".length(), title.length()-")".length());; groups.add(group); } return groups; }
ede92f33-0259-483e-b792-1bfaab7f590d
public HelperBase(ApplicationManager manager) { this.manager = manager; this.driver = manager.driver; }
300cb61f-142f-4278-897f-5e84dec84b14
public boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } }
760cdffd-e373-465a-a2dd-8403802b8caa
public String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } }
7e42817c-0a8a-4c52-a1a9-ab5c8fac1991
public boolean isAlertPresent() { try { driver.switchTo().alert(); return true; } catch (NoAlertPresentException e) { return false; } }
a7cd3196-1f8c-413a-ab07-2e97c361a24d
protected void type(By locator, String text) { if (text != null) { driver.findElement(locator).clear(); driver.findElement(locator).sendKeys(text); } }
ccda79e4-58b0-43a2-b385-1cfb181e7971
protected void click(By locator) { driver.findElement(locator).click(); }
327f085c-a7eb-44d8-9c5f-229a62b2d159
protected void selectByText(By locator, String text) { new Select(driver.findElement(locator)).selectByVisibleText(text); }
7139c307-d96a-4f85-8f06-23eeda0fe9f4
public Background(String filename){ this.setPreferredSize(new Dimension(600, 500)); this.setLayout(new BorderLayout()); background = new ImageIcon(getClass().getResource(filename)).getImage(); }
8c3194ab-8b49-4188-88a0-900445159672
@Override public void paintComponent(Graphics g) { g.drawImage(background, 0, 0, getWidth(), getHeight(), this); }
d1c26b5c-e0eb-4935-b4b4-f440b6eceade
public Users(String username, String password, String name) { this.username = username; this.password = password; this.name = name; }
00468c70-65a1-4fa8-bd5b-d1ad9a946f4c
public String getName() { return name; }
8bb85e5d-4e4a-41df-a07b-f84a37a77f9f
public void setName(String name) { this.name = name; }
22fbef3d-c3f0-4c03-b1ea-2678b57aaa32
public boolean checkPassword(String password){ return this.password.equals(password); }
ac27e85b-40bc-4239-b515-672b7a0b6f6c
public String getUsername() { return username; }
afcb43dc-7353-4cf0-96b8-9627dfc1507c
public void setUsername(String username) { this.username = username; }
35fe9d75-b6b8-4095-8327-a36f86e4c9c9
public static void main(String[] args){ View view = new View(); view.start(); }
5ede9b70-aa18-4e61-b47a-6d2fb1d5d182
public Assignment(String name, double possibleGrade){ this.name = name; this.totalGrade = 0; this.possibleGrade = possibleGrade; this.acquiredGrade = -1; }
10b130d9-3e16-4d3b-8a50-27e19cfb6547
public double getTotalGrade() { totalGrade = acquiredGrade/possibleGrade; totalGrade *= 100; return totalGrade; }
8ea9a60b-68c9-419d-8630-d91e7137b21f
public void setTotalGrade(double totalGrade) { this.totalGrade = totalGrade; }
56e73939-af18-4c52-8e0d-90b08b3a2ba6
public double getPossibleGrade() { return possibleGrade; }
b65f0044-a36a-4896-b613-19fcd6385698
public void setPossibleGrade(double possibleGrade) { this.possibleGrade = possibleGrade; }
2b280418-6d20-4044-bdb6-e51f877ec350
public double getAcquiredGrade() { return acquiredGrade; }
664adaeb-01ec-40fe-9224-7743be040de4
public void setAcquiredGrade(double acquiredGrade) { this.acquiredGrade = acquiredGrade; }
0490858f-ca43-4751-b8b4-9ce34b0b4338
public String getName() { return this.name; }
de8880d0-bc21-4d0e-a6ef-e308ffc6242d
public void setName(String name) { this.name = name; }
6182faa8-19ca-4380-9dec-2ddd8a3c7e94
public String getNameGrade(){ return this.name + " - " + getTotalGrade() + "%"; }
878192e0-e47e-4742-a7ba-637b7cf43eb2
public GPA(){ }
0b4dcd5e-dc53-4821-95e2-2ed01e5acd9c
public double calculateSemesterGPA(Course[] courses, int numOfCourses){ totalCredits = 0; totalGradePoints = 0; for(int i = 0; i < numOfCourses; i ++){ totalCredits += courses[i].getCredits(); if(courses[i].getTotalCharGrade() == "A"){ totalGradePoints += 4.0 * courses[i].getCredits(); } else if(courses[i].getTotalCharGrade() == "B"){ totalGradePoints += 3.0 * courses[i].getCredits(); } else if(courses[i].getTotalCharGrade() == "C"){ totalGradePoints += 2.0 * courses[i].getCredits(); } else if(courses[i].getTotalCharGrade() == "D"){ totalGradePoints += 1.0 * courses[i].getCredits(); } else if(courses[i].getTotalCharGrade() == "F"){ totalGradePoints += 0.0 * courses[i].getCredits(); } else{ totalGradePoints += 4.0 * courses[i].getCredits(); } } double GPA = totalGradePoints/totalCredits; return GPA; }
ea76acdf-1579-4242-97e3-04f7ee7c0467
public int getTotalCredits() { return totalCredits; }
2988ce30-1932-4886-bf30-3d208da2cae7
public void setTotalCredits(int totalCredits) { this.totalCredits = totalCredits; }
1486a00b-54e3-414b-b851-fc78c32dbab0
public double getTotalGradePoints() { return totalGradePoints; }
26b52a83-4579-4e9f-8adb-8c9f31c2c3ad
public void setTotalGradePoints(double totalGradePoints) { this.totalGradePoints = totalGradePoints; }
ba6c4343-8df4-4dd3-836a-f2860e885110
public Predicter(){ }
bf32a84f-cda8-4a06-92f9-4698ed4ab791
public double[] predict(AssignmentCategory[] categories, double desiredPercentage){ double[] requiredPercentage = new double[categories.length]; for(int i = 0; i < categories.length; i ++){ int incompleteAssignments = categories[i].getAssignmentCounter() - categories[i].getNumCompleteAssignments(); double currentTotal = categories[i].getNumCompleteAssignments() * categories[i].getGrade(); double possibleTotal = (desiredPercentage * (categories[i].getWeight()/100.0)) * categories[i].getAssignmentCounter(); double percentagePerAssignment = ((possibleTotal - currentTotal) / incompleteAssignments) / (categories[i].getWeight()/100.0); requiredPercentage[i] = percentagePerAssignment * 100; } return requiredPercentage; }
26ad06cc-63db-44a9-9dbc-b6d745f41e94
public AssignmentCategory(String name, int weight){ this.name = name; this.weight = weight; this.assignments = new Assignment[5]; assignmentCounter = 0; grade = 0; assignment = null; }
316ce316-29e6-4f94-960b-ee93ae193818
public void addAssignment(Assignment assignment){ if(assignmentCounter >= assignments.length){ expandArray(); } assignments[assignmentCounter] = assignment; assignmentCounter ++; }
1ad37e3e-0e42-4c93-972b-260563b60467
public void expandArray(){ Assignment[] tempArray = new Assignment[assignments.length + 2]; for(int i = 0; i < assignments.length; i ++){ tempArray[i] = assignments[i]; } assignments = tempArray; }
75d42482-6270-4633-a921-bdd7596c58e9
public void removeAssignment(int assignmentNum){ assignments[assignmentNum] = null; assignmentCounter --; Assignment[] temp = new Assignment[assignmentCounter]; int counter = 0; for(int i = 0; i < assignments.length; i ++){ if(assignments[i] != null){ temp[counter] = assignments[i]; counter ++; } } assignments = temp; }
dcfe2fd0-a297-4742-bb9e-fb606d98dcb0
public String getName() { return name; }
9e06e576-49aa-4fd1-a6d3-821cbe6975c4
public void setName(String name) { this.name = name; }
60edcac7-c630-49f3-a18f-bfb99e4fc8f2
public int getWeight() { return weight; }
5a4cbd59-a3a5-4a30-99d6-b0339b30c0ea
public void setWeight(int weight) { this.weight = weight; }
be07a854-b458-4e8c-985b-96fae38587f1
public double getGrade() { double totalPossibleGrade = 0; double totalAcquiredGrade = 0; getNumCompleteAssignments(); for(int i = 0; i < assignmentCounter; i ++){ if(assignments[i].getAcquiredGrade() >= 1){ totalPossibleGrade += assignments[i].getPossibleGrade(); totalAcquiredGrade += assignments[i].getAcquiredGrade(); } } grade = (totalAcquiredGrade/totalPossibleGrade) * (weight/100.0); return grade; }
8395f02d-c670-4d49-a3ad-5e24fb64e9b5
public double calculateFat(int weightLeft){ fat = weight + weightLeft; double totalPossibleGrade = 0; double totalAcquiredGrade = 0; getNumCompleteAssignments(); for(int i = 0; i < assignmentCounter; i ++){ if(assignments[i].getAcquiredGrade() >= 1){ totalPossibleGrade += assignments[i].getPossibleGrade(); totalAcquiredGrade += assignments[i].getAcquiredGrade(); } } double newGrade = (totalAcquiredGrade/totalPossibleGrade) * (fat/100.0); return newGrade; }
ec52cc8d-8ab6-4504-8cbb-7dc50691b4f4
public double getTotalGrade(){ int totalPossibleGrade = 0; for(int i = 0; i < numCompleteAssignments; i ++){ if(assignments[i].getAcquiredGrade() >= 1){ totalPossibleGrade += assignments[i].getPossibleGrade(); } } return totalPossibleGrade; }
4b25756c-9c3c-4810-bfe2-fddad9a5a532
public Assignment getAssignment(int assignmentNum) { return assignments[assignmentNum]; }