• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Syntax problem

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a class (name Journee (means Day)
Now I'm trying to say in class method and my instances method
if they select Saturday or Sunday this means weekend

and in my other method I have to say if it's not Saturday or sunday then it equald a weekday.

The main problem that I have, is I have no idea how to code this.
I tried couple thing, but I'm looking (probably at the wrong place) I would really appreciate some help
I tried writing a few stuff but it dosen't hurt !!

here what I have so far ( it's all in french tough!!)


public class Journee {

// Cette classe contient l'information sur le jour de la semaine inscrit

// variable(s) de classe s'il y a lieu
final public static String Lundi = "lu";
final public static String Mardi = "ma";
final public static String Mercredi = "me";
final public static String Jeudi = "ju";
final public static String Vendredi = "ve";
final public static String Samedi = "sa";
final public static String Dimanche = "di";
public String Journee;

// variable(s) d'instance s'il y a lieu
private String jourDeLaSemaine;

// constructeur(s) s'il y a lieu
public Journee (String jourDeLaSemaine){
Journee = new String ();
}
// m�thode(s) de classe s'il y a lieu
// Permet de v�rifier si le jour de la semaine entr�e est Sa ou Di
public boolean equals (Journee j1){
boolean result;
if(this.jourDeLaSemaine ==j1.jourDeLaSemaine){
result;

// m�thode(s) d'instance s'il y a lieu
public boolean equals (Journee j2){
boolean result;
if(this.jourDeLaSemaine ==j2.jourDeLaSemaine){

} // Journee



thanks
 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can have a method called isWeekend which returns a boolean.

In the method, you can return true if the day is satur or sun.
reply
    Bookmark Topic Watch Topic
  • New Topic