Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Nov 13th, 2006, 9:28 PM   #1
akbomber
Newbie
 
Join Date: Nov 2006
Posts: 4
Rep Power: 0 akbomber is on a distinguished road
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.
akbomber is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:09 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC