`
This is the code

/*Practice Assessment 2 - Question 5
Program to calculate how many days and weeks in a given month
24/2/15*/

import java.util.*;
public class calender
{
   public static void main (String []args)
   {
      Scanner keyboardIn = new Scanner (System.in);
      String month;
      int days_in_month, weeks, days;
      System.out.print ("enter the name of the month");
      month = keyboardIn.nextString ();
      System.out.print ("enter the number of days in the month");
      days_in_month = keyboardIn.nextInt ();
      weeks = days_in_month / 7;
      days = days_in_month % 7;
      System.out.print ("there are" +weeks "in"+month " and "+days " days ");
   }
}

and this is the error I am getting.

calender.java:19: error: ')' expected
      System.out.print ("there are" +weeks "in"+month " and "+days " days ");
                                          ^
calender.java:19: error: not a statement
      System.out.print ("there are" +weeks "in"+month " and "+days " days ");
                                               ^
calender.java:19: error: ';' expected
      System.out.print ("there are" +weeks "in"+month " and "+days " days ");
                                                     ^
calender.java:19: error: not a statement
      System.out.print ("there are" +weeks "in"+month " and "+days " days ");
                                                              ^
calender.java:19: error: ';' expected
      System.out.print ("there are" +weeks "in"+month " and "+days " days ");
                                                                  ^
5 errors

 ----jGRASP wedge2: exit code for process is 1.
 ----jGRASP: operation complete.

`

Recommended Answers

All 3 Replies

You are using + to concatenate stuff for printing, OK, but you have left some out. You need a + between every expression..
"there are " + weeks + " in " + (etc)

Ok thanks for the help.

System.out.print ("there are "+weeks+"in "+month+"and "+days+"days");

commented: Just repeats previous info. Not a contribution +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.