• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What am I doing Wrong?

 
Pam Perkins
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could someone please tell what I am doing wrong with this code that is driving me so crazy?
Thanks,
Pam Perkins
public class Student
{
private String Name;
private String techID;
privateint []hw = new int[5];
privateint []lab = new int[10];
privateint [] test= new int[2];
privateint finalProject =0;
//remember to set the arrays and get the arrays
}
//----------------------------------
// Constructors
//----------------------------------
/**
* Default constructor
*/
// public Student()
// {
// }
/**
* Constructs a new Student with passed name,
* age,and gender.
*
* @param name name of the new Student
* @param age age of the new Student
* @param gender gender of the new Student
*/
public Student(String Name_, String techID_) {

Name = Name_;
techID = techID_;
}
public void setName(String Name_)
}
Name = Name_;
}
public String getName( )
{
return Name;
}
public void setTechID(String techID_)
{
techID = techID_;
}
public String getTechID( )
{
return techID;
}

public int calcHomework() {
//int totalHW = 0;
if(hw.legth > 0) {
int bestOffour = hw[0];
for(int i = 1; i < hw.length; i++) {
if (hw[i] < bestOffour)
bestOffour = hw[i];
}
return bestOffour;
}
else
return 0;
}
private int calLab() {
// find the smallest ofleast two of the the ten lab
if(laB.length > 0) {
int twoLowestLab = laB[0]; // remember the the first score
// Remember any smaller scores.
for(int i = 1; i < laB.length; i++) {
if (laB[i] < twoLowestLab)
twolowestLab = laB[i];
}
return laB;
}
else
return 0;// the array is empty
}
private int calTest() {

int sum = 0;
for (int i = 0; i <.test.length; i++)
sum += test[i];
if(test.length > 0)
return (int) test + (int) test.length;
else
return 0;
}
}
private int calGrandTotal () {
// This compute the grand total
int grandTotal = 0;
for (int i = 0; < grandTotal.length; i++)
grandTotal += (grandTotal[i] + hw[i] + test[i] + lab[i] / grandTotal);
}
private int calPercentage () {
int percentage = 0;
for (int i = 0; < grandTotal[i] + hw[i] + laB[i] / 100);

}
public String toString () {
return this toString() + "Name" + Name + "TechID" + techID + "HomeWork"+ hw + "labs"
+ lab + "test" + test;
}
}
 
Susilo Saja
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it compile-error? if it's, what is the message?
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pam Perkins:
Could someone please tell what I am doing wrong with this code that is driving me so crazy?
Thanks,
Pam Perkins

So you have an extra close bracket at the start of the class that prevents your methods from being included...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic