a2_40033727.java - /a2_40033727-Assignment 2 Written by Othmane Zahrane 40033727 For COMP 248 Section R – Fall 2019 This program is a persian calendar

a2_40033727.java - /a2_40033727-Assignment 2 Written by...

This preview shows page 1 out of 1 page.

//a2_40033727 // ------------------------------------------------------- // Assignment 2 // Written by: Othmane Zahrane 40033727 // For COMP 248 Section R – Fall 2019 // -------------------------------------------------------- /* This program is a persian calendar which gives the month's name and season according to a input number from 1 to 12,firstly with a serie of if-else statements and secondly with the switch method */ import java.util.Scanner; //importing Scanner method class a2_40033727 { public static void main(String[]args){ System.out.println("Welcome to my persian calendar program"); // print welcome message Scanner sc=new Scanner(System.in); //scanner for input stream int month_no; //represent the month System.out.println("Please enter the month as a number 1-12:"); // indicate what & where the month_# should be entered { month_no=sc.nextInt(); // read user input and put it in month if(month_no> 0 && month_no<=12) //condition to output month name and message related to number between 1 and 12 { if(month_no==1){System.out.println("We are in Farvadin,Happy Spring");} else if(month_no==2){System.out.println("We are in Ordibehesht,Happy
Image of page 1
  • Spring '08
  • T.B.A

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes