infested13
18th Sep 2008 Thu, 20:00
Assignment ko 2..
Write a program that will determine and display the grade and the grade equivalent of the student.
37.5 - 74.49 = 5
74.5 - 77.49 = 3
77.5 - 80.49 = 2.75
80.5 - 83.49 = 2.50
83.5 - 86.49 = 2.25
86.5 - 89.49 = 2
89.5 - 92.49 = 1.75
92.5 - 95.49 = 1.50
95.5 - 98.49 = 1.25
98.5 - 100.00 = 1
Tas dpat gnito ung output.
Your grade is __.
The grade equivalent is __.
E2 po code ko.. Error eh..
import java.io.*;
public class Grades
{
public static void main(String args[])
{
Scanner reader = new Scanner(System.in);
double grade = reader.nextDouble();
if (grade > 37.5 && grade < 74.49) System.out.println("Your grade is " + grade + ".\nThe equivalent is 5.");
if (grade > 74.5 && grade < 77.49) System.out.println("Your grade is " + grade + ".\nThe equivalent is 3.");
tinuloy q lng yan gang umabot sa 100.00 pro error eh..Help!
rnoldec
19th Sep 2008 Fri, 13:30
anu po yung specific na error description?
kasi may hint po para ma-solve galing sa error description na ni-return nung program nyo.
virusx
19th Sep 2008 Fri, 14:49
public class Grade {
public Grade() {
super();
// TODO Auto-generated constructor stub
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
double grade;
byte[] buff;
buff = new byte[30];
try{
System.out.print("Enter Grade:");
System.in.read(buff);
grade = Double.parseDouble( new String(buff));
if (grade > 37.5 && grade < 74.49) System.out.println("Your grade is " + grade + ".\nThe equivalent is 5.");
//more if's here...
}
catch(Exception e){
// handle error
// System.out.println(e.getMessage());
System.out.println("Invalid input");
}
}
}
infested13
23rd Sep 2008 Tue, 10:48
E2 pa po..
Write a program that will ask the user to input his birth month and date. The program will determine and display the birht month, birth date, zodiac sign as well as their respective horoscope.
Sample output:
Input your birthmonth (in number): 5
Input your birthdate (in number): 10
You were born on May 10. You are a Taurus!
Horoscope: Blah blah blah.
Note: any horoscope will do for every zodiac..
virusx
23rd Sep 2008 Tue, 11:11
Bro, similar problem lang yan nung first, konting revisions at dagdag nalng. kayang kaya mo yan...
infested13
23rd Sep 2008 Tue, 11:24
Bro, similar problem lang yan nung first, konting revisions at dagdag nalng. kayang kaya mo yan...
Confusing lang kc ung sa month eh kc may month na 31 days, 30 days at february 28 days..
virusx
23rd Sep 2008 Tue, 13:08
public class zODIAC {
public zODIAC() {
super();
// TODO Auto-generated constructor stub
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int bmonth;
int bdate;
byte[] buff;
buff = new byte[11];
try{
System.out.print("Input your birthmonth (in number):");
System.in.read(buff);
bmonth = Integer.parseInt( new String(buff).trim());
// validate user input here for month range...(bmonth should be 1 to 12)
System.out.print("Input your birthdate (in number):");
System.in.read(buff);
//validate user input here for date range...
bdate = Integer.parseInt( new String(buff).trim());
// validate user input here for date range...(test for 31,30,28 --constant nman mga ito, never mind leap year kc di nmn involve ang year)
if ((bmonth == 01 && bdate > 19) || (bmonth ==02 && bdate < 19)){
System.out.println("You were born on " + getMonth(bmonth) + " " + bdate + ". You are a Aquarius!");
}
//more ifs
}
catch(Exception e){
// handle error
// System.out.println(e.fillInStackTrace());
System.out.println("Invalid input");
}
}
private static String getMonth(int mon){
String month="";
switch(mon){
case 1: month="January";break;
case 2: month="February";break;
case 3: month="March";break;
//more case here
}
return month;
}
}
tuloy mo nalng yan...
infested13
23rd Sep 2008 Tue, 19:23
kua ung sa buff = byte[] panu mu mlalaman kung anu ung value na ilalagay sa byte?