![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Nov 2006
Posts: 4
Rep Power: 0
![]() |
indentifier expected
i am a noob at java so my problem could quite possibly be really easy to fix
what im trying to do is get it so for a day in January it will display the day of week sunday being 0 and i keep gettin an identifier expected error import java.util.Scanner;
public class DayOfWeek
{
String dayName;
public int dayOfWeek1(int day);
{
dayOfWeek1 = (day - 1) % 7;
return dayOfWeek1;
}
public static void main(String[] args)
{
Scanner kb = new Scanner(System.in);
System.out.println("Enter Day in January (1-31): ");
int day = kb.nextInt();
if(dayOfWeek1 = 0)
{
dayName = "Sunday";
}
if(dayOfWeek1 = 1)
{
dayName = "Monday";
}
if(dayOfWeek1 = 2)
{
dayName = "Tuesday";
}
if(dayOfWeek1 = 3)
{
dayName = "Wednesday";
}
if(dayofWeek1 = 4)
{
dayName = "Thursday";
}
if(dayOfWeek1 = 5)
{
dayName = "Friday";
}
if(dayOfWeek1 = 6)
{
dayName = "Saturday";
}
}
system.out.println(dayName);
}Last edited by akbomber; Nov 13th, 2006 at 10:06 PM. |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| error: expected primary-expression... | rup | C++ | 18 | Apr 17th, 2006 2:24 PM |
| realloc not functioning as expected | nnxion | C | 24 | Nov 29th, 2005 6:20 PM |
| Total noob, trouble expected? | Mudanie | Python | 18 | Oct 27th, 2005 10:03 AM |
| Homework Problem 2 | Cup O' Java | Java | 3 | Mar 1st, 2005 11:46 PM |