[GUILD] Assignment 5

Need help with your code? Post it here and we'll try our best to help.
User avatar
Kamasabi
Is Gettin' Pwned
Posts: 9
Joined: Tue Jul 17, 2007 11:01 pm
Contact:

[GUILD] Assignment 5

Postby Kamasabi » Wed Oct 17, 2007 11:55 pm

Code: Select all

abstract class Student
{
   public String name;
   public String major;
   public int hoursEarned;
   public int pointsEarned;
   
   public Student(String newName, String newMajor, int newHoursEarned, int newPointsEarned)
   {
      name = newName;
      major = newMajor;
      hoursEarned = newHoursEarned;
      pointsEarned = newPointsEarned;
   }
   public void setName(String name1)
   {
      name = name1;
   }
   public void setMajor(String major1)
   {
      major = major1;
   }
   public void setHoursEarned(int hoursEarned1)
   {
      hoursEarned = hoursEarned1;
   }
   public void setPointsEarned(int pointsEarned1)
   {
      pointsEarned = pointsEarned1;
   }
   public String getName()
   {
      return name;
   }
   public String getMajor()
   {
      return major;
   }
   public int getHoursEarned()
   {
      return hoursEarned;
   }
   public int getPointsEarned()
   {
      return pointsEarned;
   }
   public abstract boolean isOnProbation();   
}






public class Undergraduate extends Student
{
   public Student()
   {
      super();
   }
   public Student(String newName, String newMajor, int newHoursEarned, int newPointsEarned)
   {
      super(newName, newMajor, newHoursEarned, newPointsEarned);
   }
      
   public boolean isOnProbation()
   {
      double gpa;
      gpa = pointsEarned/hoursEarned;
      if(gpa <2.0)
         return true;
      else
         return false;
   }
}

User avatar
Tanis Half Elf
Is Kind Of A Big Deal
Posts: 944
Joined: Tue Jul 03, 2007 11:00 pm
Location: Greensburg,La

Postby Tanis Half Elf » Thu Oct 18, 2007 1:27 pm

If you ever have a problem with missing brackets i found they are easiest to find when you tier them. It helps with 200+ line code. it has been a year since i did code: (not real code below)

{
cout<<"E";
E=MC^2
....{
E=Eggs
....}
...........{
m=Mandragor
...........}
...............{
C= Celestial Stars
...................{
X=Xena
...................}
...............}
}
return 0;


Return to “Code Monkeys”

Who is online

Users browsing this forum: No registered users and 2 guests