Skip to Content

Translate Page

Use of arrow keys when focused on the Google language option field will translate site content on the fly. Use your enter key to review all options and choose your selection before applying.
McFarland School District
McFarland High (9-12)
  • McFarland High (9-12)
    • McFarland High School
    • Academic & Career Planning (ACP)
      • Youth Apprenticeship
    • Athletic & Activity Code of Conduct
    • Canvas Login
    • Clubs
    • Communications
    • Course Supply List
    • Daily Announcements
    • Daily Schedules
    • Family Handbook
    • Grading Handbook
    • Graduation Information
    • Library Media Services
    • Music
    • Office Staff
    • PBIS
    • Portfolio Resources
    • Progressive Behavior Response Plan
    • Report Suspicious Activity
    • School To Career
    • Spartan Headquarters
    • Special Education
    • Sports
      • Boys Teams
        • Baseball
        • Basketball
        • Football
        • Golf
        • Hockey
        • Lacrosse
        • Soccer
        • Swimming
        • Tennis
      • Coed Teams
        • Cross Country
        • Track & Field
        • Wrestling
      • Girls Teams
        • Basketball
        • Dance
        • Golf
        • Hockey
        • Lacrosse
        • Soccer
        • Softball
        • Swimming
        • Tennis
        • Volleyball
      • 24-25 Sport Registration-Athletic Code Video
      • Athletic & Activity Code of Conduct
      • Concussion & Sudden Cardiac Arrest Info
      • Infinite Campus Sport Registration Info Sheet
      • Parent Resources
      • Parent Transportation Form
      • Spartan Sport Sponsors
      • Uniform Care Info
      • WIAA Medical Eligibility Form
    • Staff Directory
    • Student Services
      • Transcript Request (former students)
    • Xello - Student
    • Web Design 1
      • Class Lessons
        • XHTML Tutorial
        • CSS Tutorial
        • Form Tutorial
        • Graphics
        • Dreamweaver
        • QuickMenu
        • Joomla!
      • Assignments
        • Site 1: Biography
        • Site 2: Fan Club
        • Site 3: Mixed Media
        • Site 4: Joomla!
      • Student Samples
        • Biography Sites
        • Fan Club Sites
        • Mixed Media Sites
        • Joomla! Sites
      • Helpful Sites
        • XHTML Help
        • CSS Help
        • Validation
        • QuickMenu
        • Joomla! Help
    • Web Design 2
      • Class Lessons
        • JavaScript Tutorial
        • PHP Tutorial
        • MySQL Tutorial
        • Admin - CMS
      • Assignments
        • Using JavaScript
        • For the Birds
      • Helpful Sites
        • JavaScript Tutorials
        • RegExp Help
        • Web Page Validation
    • Programming 1
      • Class Lessons
        • CLASS SET-UP
        • Logic Test
        • Class Preparation
        • Using BlueJ
        • --------------------
        • SET 1 LESSONS:
        • Printing
        • Variables
        • User Input
        • Random Number
        • Arithmetic
        • --------------------
        • SET 2 LESSONS:
        • If
        • Switch
        • --------------------
        • SET 3 LESSONS:
        • Looping
        • --------------------
        • SET 4-5 LESSONS:
        • Arrays
        • --------------------
        • SET 6 LESSONS:
        • String Manipulation
      • Problem Sets
        • Set 1: Basic Skills
        • Set 2: If & Switch
        • Set 3: Loops
        • Project: Craps
        • Set 4: Single Array
        • Set 5: Double Array
        • Set 6: Strings
      • Solution Sets
        • Problem Set 1
        • Problem Set 2
        • Problem Set 3
        • Problem Set 4
        • Problem Set 5
        • Problem Set 6
      • Helpful Sites
    • Programming 2
      • Class Lessons
        • Using BlueJ
        • What is an Object?
        • What is a Class?
        • GUI Programming
      • Problem Sets
        • Set 1 - Shapes
        • Set 2 - Exercises
        • Set 3 - Exercises
        • Set 4 - Exercises
        • Project - Adding
        • Set 5 - GUI by Hand
        • Project - NetBeans
        • Set 6 - NetBeans
        • Project - Life
        • Project - Slide Puzzle
        • Project - Matching
      • Solution Sets
        • Problem Set 1 (none)
        • Problem Set 2 (none)
        • Problem Set 3 (none)
        • Problem Set 4
  • Home
  • District
    • Referendum November 5, 2024
      • Impact Tax Calculator
    • Strategic Plan
    • School Board
      • Agendas, Minutes & Notices
      • Board Member Informational Brochure
      • District Policies
      • Meeting Calendar
      • Meeting Recordings
      • Members
      • Non-Discrimination Policy
      • Notice of Educational Options
      • Notices
      • Resolutions
    • Departments & Administration
      • District Administrator Message
        • Tarnutzer's Travels
      • Diversity, Equity, Inclusion & Belonging
      • Administrative Staff
      • Building & Grounds
        • Facility Use / Rental
      • Business Services
      • Finances
      • Health Services
      • McFarland Recreation Activities & Play (MRAP)
        • Current Events / News
        • Community Recreation Partners
      • Public Records Requests
      • School Nutrition
        • Lunch Menus
      • Special Education
        • What is Special Education?
        • Contact Information
        • Resources
      • Student Services
        • Community Resources
        • District Programs
        • Family Resources
        • Student Services Team Members
      • Summer School
      • Teaching & Learning
        • Assessments for Learning
        • Curriculum
        • Wisconsin Academic Standards
        • Early Literacy - Wisconsin Act 20
      • Transportation
        • Bus Safety Videos
        • StopFinder
    • Prospective Families & Staff
      • About McFarland
      • District Boundary Map
      • District Mission & Vision
      • Employment
      • Enrollment Process
        • Online Enrollment
      • Open Enrollment
      • Residency Questions
      • School and District Report Cards
    • Staff Resources
      • Assessment Calendar (District)
      • Assistive Technology
      • Branding/Logos
      • Building & Grounds Info Sheet
      • Calendar Dates - Staff 24-25
      • Calendar Dates - Staff 25-26
      • Canvas Login
      • Educator Effectiveness
      • Employee Assistance Program
      • Employee Handbook
      • FAQ - Employee Services
      • Field Trip Requests
      • Finance Forms
      • FMLA
      • Fundraising
      • Hiring Procedure
      • HR and Business Services
      • HR HERMAN
      • Infinite Campus Staff Login
      • Insurance
      • Maintenance & Facilities Requests
      • Mentoring Resources
      • Payroll Forms
      • PD Points Tracker
      • SeeSaw Staff Login
      • Skyward
      • Student Teacher
      • Substitute Request
      • Technology (IT) Help Desk
      • Technology Department
      • Technology Orientation
      • Time-Off
      • TSG Info & Timelines
      • Web Site Admin
      • WECAN Links
      • Xello - Staff Login
  • Families
    • All
      • 2024-2025 School Hours
      • 2024-2025 Calendar Dates
      • 2025-2026 Calendar Dates
      • Calendar - All District
      • Canvas Login
      • Communications
      • Daily Schedules
      • Emergency Protocol
      • Handbooks
      • McFarland Mobile App
      • Online Registration
        • Registration Documents
      • Safety
      • Safety and Bullying Tip Line - SUSO
      • School and District Report Cards
      • Social Media
      • Spartan Headquarters
      • Supply Lists
    • Students
      • Canvas Student Login
      • Library Resources
    • Parents/Guardians
      • Absence Reporting
      • Advanced Learner (GT)
      • Canvas Parent Login
      • Drug & Alcohol Resources
      • Dyslexia Information Guide
      • English Learners (EL)
        • Eligibility
        • Philosophy
        • DPI Language Levels
        • Resources
      • Gun Safety Resources
      • Human Growth & Development Booklet
      • Joining Forces for Families
      • McFarland Music Boosters
      • School Nutrition
      • Special Education
      • Transportation
      • Volunteer Application & Disclosure Form
      • Volunteer Handbook
      • Weather Cancellation Days
    • Important Links
      • ACT Prep
      • Drivers Ed
      • Google Apps
      • Infinite Campus
      • Lunch Menus
      • McFarland Public Library
      • Summer School
      • Work Permits
      • Xello - Student (w/Free ACT Method Test Prep
    • Other
      • McFarland Thistle
      • McFarland Youth Center
      • Outdoor Programs
        • Resources
      • McFarland School Forest
        • Bird Boxes
        • Bird Feeders
        • Bird Song Board
        • Fauna
        • Flora
        • Habitats
        • Silver Award
        • Our Supporters
  • Community
    • Community Pool
    • Facilities Use / Rental
    • McFarland Education Foundation (MEF)
    • McFarland Performing Arts Center (PAC)
    • McFarland Public Library
    • McFarland Recreation, Activities & Play(MRAP)
    • School Visitors
    • Summer School
    • Village of McFarland
  • Contact Us
    • District Office
    • School Offices
    • Staff Directory
    • Web Site Feedback
    • Spartan Shout Outs
  • A-Z Links
  • Staff Resources
  • Website Guide - Learn Your Way Around
  • 2024-2025 Calendar Dates
  • 2025-2026 Calendar Dates
  • See Something Say Something Reporting

Schools

  • McFarland Primary School (4K-2)
  • Waubesa Intermediate (3-5)
  • Indian Mound Middle (6-8)
  • McFarland High (9-12)
  • Online Virtual Charter Schools
District Home

Important Links

  • Canvas Login
  • District Calendar
  • Lunch Menus
  • Infinite Campus - Student/Parent
  • Infinite Campus - Staff
  • Staff Directory

If

McFarland High (9-12)

    • McFarland High School
    • Academic & Career Planning (ACP)
      • Youth Apprenticeship
    • Athletic & Activity Code of Conduct
    • Canvas Login
    • Clubs
    • Communications
    • Course Supply List
    • Daily Announcements
    • Daily Schedules
    • Family Handbook
    • Grading Handbook
    • Graduation Information
    • Library Media Services
    • Music
    • Office Staff
    • PBIS
    • Portfolio Resources
    • Progressive Behavior Response Plan
    • Report Suspicious Activity
    • School To Career
    • Spartan Headquarters
    • Special Education
    • Sports
      • Boys Teams
        • Baseball
        • Basketball
        • Football
        • Golf
        • Hockey
        • Lacrosse
        • Soccer
        • Swimming
        • Tennis
      • Coed Teams
        • Cross Country
        • Track & Field
        • Wrestling
      • Girls Teams
        • Basketball
        • Dance
        • Golf
        • Hockey
        • Lacrosse
        • Soccer
        • Softball
        • Swimming
        • Tennis
        • Volleyball
      • 24-25 Sport Registration-Athletic Code Video
      • Athletic & Activity Code of Conduct
      • Concussion & Sudden Cardiac Arrest Info
      • Infinite Campus Sport Registration Info Sheet
      • Parent Resources
      • Parent Transportation Form
      • Spartan Sport Sponsors
      • Uniform Care Info
      • WIAA Medical Eligibility Form
    • Staff Directory
    • Student Services
      • Transcript Request (former students)
    • Xello - Student
    • Web Design 1
      • Class Lessons
        • XHTML Tutorial
        • CSS Tutorial
        • Form Tutorial
        • Graphics
        • Dreamweaver
        • QuickMenu
        • Joomla!
      • Assignments
        • Site 1: Biography
        • Site 2: Fan Club
        • Site 3: Mixed Media
        • Site 4: Joomla!
      • Student Samples
        • Biography Sites
        • Fan Club Sites
        • Mixed Media Sites
        • Joomla! Sites
      • Helpful Sites
        • XHTML Help
        • CSS Help
        • Validation
        • QuickMenu
        • Joomla! Help
    • Web Design 2
      • Class Lessons
        • JavaScript Tutorial
        • PHP Tutorial
        • MySQL Tutorial
        • Admin - CMS
      • Assignments
        • Using JavaScript
        • For the Birds
      • Helpful Sites
        • JavaScript Tutorials
        • RegExp Help
        • Web Page Validation
    • Programming 1
      • Class Lessons
        • CLASS SET-UP
        • Logic Test
        • Class Preparation
        • Using BlueJ
        • --------------------
        • SET 1 LESSONS:
        • Printing
        • Variables
        • User Input
        • Random Number
        • Arithmetic
        • --------------------
        • SET 2 LESSONS:
        • If
        • Switch
        • --------------------
        • SET 3 LESSONS:
        • Looping
        • --------------------
        • SET 4-5 LESSONS:
        • Arrays
        • --------------------
        • SET 6 LESSONS:
        • String Manipulation
      • Problem Sets
        • Set 1: Basic Skills
        • Set 2: If & Switch
        • Set 3: Loops
        • Project: Craps
        • Set 4: Single Array
        • Set 5: Double Array
        • Set 6: Strings
      • Solution Sets
        • Problem Set 1
        • Problem Set 2
        • Problem Set 3
        • Problem Set 4
        • Problem Set 5
        • Problem Set 6
      • Helpful Sites
    • Programming 2
      • Class Lessons
        • Using BlueJ
        • What is an Object?
        • What is a Class?
        • GUI Programming
      • Problem Sets
        • Set 1 - Shapes
        • Set 2 - Exercises
        • Set 3 - Exercises
        • Set 4 - Exercises
        • Project - Adding
        • Set 5 - GUI by Hand
        • Project - NetBeans
        • Set 6 - NetBeans
        • Project - Life
        • Project - Slide Puzzle
        • Project - Matching
      • Solution Sets
        • Problem Set 1 (none)
        • Problem Set 2 (none)
        • Problem Set 3 (none)
        • Problem Set 4
    • McFarland High School
    • Academic & Career Planning (ACP)
      • Youth Apprenticeship
    • Athletic & Activity Code of Conduct
    • Canvas Login
    • Clubs
    • Communications
    • Course Supply List
    • Daily Announcements
    • Daily Schedules
    • Family Handbook
    • Grading Handbook
    • Graduation Information
    • Library Media Services
    • Music
    • Office Staff
    • PBIS
    • Portfolio Resources
    • Progressive Behavior Response Plan
    • Report Suspicious Activity
    • School To Career
    • Spartan Headquarters
    • Special Education
    • Sports
      • Boys Teams
        • Baseball
        • Basketball
        • Football
        • Golf
        • Hockey
        • Lacrosse
        • Soccer
        • Swimming
        • Tennis
      • Coed Teams
        • Cross Country
        • Track & Field
        • Wrestling
      • Girls Teams
        • Basketball
        • Dance
        • Golf
        • Hockey
        • Lacrosse
        • Soccer
        • Softball
        • Swimming
        • Tennis
        • Volleyball
      • 24-25 Sport Registration-Athletic Code Video
      • Athletic & Activity Code of Conduct
      • Concussion & Sudden Cardiac Arrest Info
      • Infinite Campus Sport Registration Info Sheet
      • Parent Resources
      • Parent Transportation Form
      • Spartan Sport Sponsors
      • Uniform Care Info
      • WIAA Medical Eligibility Form
    • Staff Directory
    • Student Services
      • Transcript Request (former students)
    • Xello - Student
    • Web Design 1
      • Class Lessons
        • XHTML Tutorial
        • CSS Tutorial
        • Form Tutorial
        • Graphics
        • Dreamweaver
        • QuickMenu
        • Joomla!
      • Assignments
        • Site 1: Biography
        • Site 2: Fan Club
        • Site 3: Mixed Media
        • Site 4: Joomla!
      • Student Samples
        • Biography Sites
        • Fan Club Sites
        • Mixed Media Sites
        • Joomla! Sites
      • Helpful Sites
        • XHTML Help
        • CSS Help
        • Validation
        • QuickMenu
        • Joomla! Help
    • Web Design 2
      • Class Lessons
        • JavaScript Tutorial
        • PHP Tutorial
        • MySQL Tutorial
        • Admin - CMS
      • Assignments
        • Using JavaScript
        • For the Birds
      • Helpful Sites
        • JavaScript Tutorials
        • RegExp Help
        • Web Page Validation
    • Programming 1
      • Class Lessons
        • CLASS SET-UP
        • Logic Test
        • Class Preparation
        • Using BlueJ
        • --------------------
        • SET 1 LESSONS:
        • Printing
        • Variables
        • User Input
        • Random Number
        • Arithmetic
        • --------------------
        • SET 2 LESSONS:
        • If
        • Switch
        • --------------------
        • SET 3 LESSONS:
        • Looping
        • --------------------
        • SET 4-5 LESSONS:
        • Arrays
        • --------------------
        • SET 6 LESSONS:
        • String Manipulation
      • Problem Sets
        • Set 1: Basic Skills
        • Set 2: If & Switch
        • Set 3: Loops
        • Project: Craps
        • Set 4: Single Array
        • Set 5: Double Array
        • Set 6: Strings
      • Solution Sets
        • Problem Set 1
        • Problem Set 2
        • Problem Set 3
        • Problem Set 4
        • Problem Set 5
        • Problem Set 6
      • Helpful Sites
    • Programming 2
      • Class Lessons
        • Using BlueJ
        • What is an Object?
        • What is a Class?
        • GUI Programming
      • Problem Sets
        • Set 1 - Shapes
        • Set 2 - Exercises
        • Set 3 - Exercises
        • Set 4 - Exercises
        • Project - Adding
        • Set 5 - GUI by Hand
        • Project - NetBeans
        • Set 6 - NetBeans
        • Project - Life
        • Project - Slide Puzzle
        • Project - Matching
      • Solution Sets
        • Problem Set 1 (none)
        • Problem Set 2 (none)
        • Problem Set 3 (none)
        • Problem Set 4

If

+
-

 

The If statement allows the computer to evaluate a condition and then act on the results. In other words, it allows the computer to make decisions about what action to take next. For example, suppose a game playing user has the score of 100 points and that is the amount necessary to win. The computer can look at the score and compare it to the amount needed to win and see that they are equal. With that knowledge the computer can take the action of declaring the user a winner.

General form of If statement:
if (condition is true)
  execute this code;

What if the condition is not true? In the sample above nothing would happen. We did not tell the computer what action to take if the condition is false. To remedy this problem view the following code sample.

General form of If with else statement:
if (condition is true)
  execute this code;
else
  execute this code;

The above code supplies the computer with the action that is to be taken if the condition is true. The code following the else line is the code executed if the condition is false.

What if there are more than two possible outcomes? For example you might say if it is raining you will bring an umbrella, if it is snowing you will wear boots and if the weather is nice you will wear tennis shoes. Now there are three possible outcomes. To remedy this problem view the following code sample.

General form of If with else if and else statement:
if (condition is true)
  execute this code;
else if (another condition is true)
  execute this code;
else
 execute this code;

The above code handles three possible outcomes. Often there are many more than three outcomes. The pattern of how many if, else if and else lines to write looks like this:


For four possible outcomes:
 if()
else if()
else if()
else

For five possible outcomes:
 if()
else if()
else if()
else if()
else

etc...

 



For each of the Programming 1 lessons you are strongly encouraged to view and play around with the sample code provided in the BlueJ Java Student Samples folder.

Open BlueJ and choose Open Project from the Project menu. Navigate to your Programming 1 folder on the I: drive and open the BlueJ Java Student Samples folder. Open the project named If.

 

 

Lesson Example: Project If, Class If, methods simpleIf(), ifWithElse(), ifWithElseIf() and usingBlocksWithIf()

  • Right-click on the Class named If and select new If()
  • Right-click on the red rectangle and choose the method named simpleIf()
  • Right-click on the red rectangle and choose the method named ifWithElse()
  • Right-click on the red rectangle and choose the method named ifWithElseIf()
  • Right-click on the red rectangle and choose the method named usingBlocksWithIf()

 

Code for method simpleIf():

void simpleIf()
{
 int num1,num2;
 System.out.print("Enter a number: ");
 num1 = in.nextInt();
 System.out.print("Enter another number: ");
 num2 = in.nextInt();
 
 if (num1>num2)
   System.out.println(num1 + " is bigger than " + num2);
}

 

 

Code for method ifWithElse():

void ifWithElse()
{
 int num1,num2;
 System.out.print("Enter a number: ");
 num1 = in.nextInt();
 System.out.print("Enter another number: ");
 num2 = in.nextInt();
 
 if (num1>num2)
  System.out.println(num1 + " is bigger than " + num2);
 else
  System.out.println(num1 + " is smaller than " + num2 + " or they are the same.");
}

 

 

Code for method ifWithElseIf():

void ifWithElseIf()
{
 int num1,num2;
 System.out.print("Enter a number: ");
 num1 = in.nextInt();
 System.out.print("Enter another number: ");
 num2 = in.nextInt();
 
 if (num1>num2)
  System.out.println(num1 + " is bigger than " + num2);
 else if (num1<num2)
  System.out.println(num1 + " is smaller than " + num2);
 else
  System.out.println(num1 + " is the same as " + num2);
}

 

 

 

Code for method usingBlocksWithIf():

void usingBlocksWithIf()
{
 int num1,num2;
 System.out.print("Enter a number: ");
 num1 = in.nextInt();
 System.out.print("Enter another number: ");
 num2 = in.nextInt();
 
 if (num1>num2)
  {
   System.out.println(num1 + " is bigger than " + num2);
   System.out.println(num1 + " is the greatest number!");
  }
 else if (num1<num2)
   System.out.println(num1 + " is smaller than " + num2);
 else
  {
   System.out.println(num1 + " is the same as " + num2);
   System.out.println(num1 + " has met it's match.");
  }
}

 

 


 

If with And

+
-

 

  • Sample Problem: Project If, Class If_And

 

Sometimes it is necessary for more than one condition to be true before the computer should execute some particular code. For example, when logging in to a restricted area you must enter a login name and password. If the login name and password are both correct you may enter otherwise you are not allowed entry.


The word 'and' is represented by the character '&'. In generic form using the & in an if statement looks like:

if(condition 1 is true & condition 2 is true)
 execute this code;

You may have as many conditions being evaluated as needed.
You may also use '&&' for 'and'. This tells the computer to stop evaluating any more conditions if one of them has already been found false. Since all conditions need to be true there would be no gain in further evaluating the remaining conditions.



For each of the Programming 1 lessons you are strongly encouraged to view and play around with the sample code provided in the BlueJ Java Student Samples folder.

Open BlueJ and choose Open Project from the Project menu. Navigate to your Programming 1 folder on the I: drive and open the BlueJ Java Student Samples folder. Open the project named If.

 

 

Lesson Example: Project If, Class If_And, methods ifAnd_01(), ifAnd_02() and compareWords()

  • Right-click on the Class named If_And and select new If_And()
  • Right-click on the red rectangle and choose the method named ifAnd_01()
  • Right-click on the red rectangle and choose the method named ifAnd_02()
  • Right-click on the red rectangle and choose the method named compareWords()

 

Code for method ifAnd_01():

void ifAnd_01()
  {
    int num1,num2;
    System.out.print("Enter a number: ");
    num1 = in.nextInt();
    System.out.print("Enter another number: ");
    num2 = in.nextInt();    
    if(num1==4 & num2 ==7)
     System.out.println("You may enter, you know the secret numbers.");
    else
     System.out.println("Leave now! You do not know the secret numbers.");
  }

 

Code for method ifAnd_02():

void ifAnd_02()
  {
    int num1;
    System.out.print("Enter a number: ");
    num1 = in.nextInt();

    if(num1>=1 & num1 <=10)
     System.out.println("You have entered a number from 1 to 10.");
    else
     System.out.println("The number entered is not from 1 to 10");
  }

 

Code for method compareWords():

void compareWords()
  {
    String firstWord,secondWord;
    System.out.print("Enter a word in all lowercase letters: ");
    firstWord = in.next();
    System.out.print("Enter another word in all lowercase letters: ");
    secondWord = in.next();    

    if(firstWord.compareTo(secondWord)< 0)
     System.out.println(firstWord + " comes before " + secondWord + " alphabetically.");
    else if (firstWord.compareTo(secondWord)> 0)
      System.out.println(firstWord + " comes after " + secondWord + " alphabetically.");
    else if(firstWord.compareTo(secondWord)== 0)// also works: if(firstWord.equals(secondWord))
     System.out.println(firstWord + " and " + secondWord + " are the same.");
  }

 

 


 

If with Or

+
-

 

  • Sample Problem: Project If, Class If_Or

 

If there is a situation where the are multiple conditions and one or more of them need to be true in order for the computer to execute some code then 'or' represented by the character '|' is useful. Imagine you have a club made up of people named Jim or Sue. Only those named Jim or Sue are allowed into your club. So, the generic code would look like:

if (condition 1 is true | condition 2 is true)
  execute this code;

In our Jim and Sue club example it might look like:

if (name=="Jim" | name=="Sue")
  execute this code;



For each of the Programming 1 lessons you are strongly encouraged to view and play around with the sample code provided in the BlueJ Java Student Samples folder.

Open BlueJ and choose Open Project from the Project menu. Navigate to your Programming 1 folder on the I: drive and open the BlueJ Java Student Samples folder. Open the project named If.

 

 

Lesson Example: Project If, Class If_Or, method ifOr_01()

  • Right-click on the Class named If_Or and select new If_Or()
  • Right-click on the red rectangle and choose the method named ifOr_01()

 

Code for method ifOr_01():

void ifOr_01()
  {
    int num1;
    System.out.print("Enter a number: ");
    num1 = in.nextInt();
   
    if(num1 < 1 | num1 >10)
     System.out.println("The number entered is not from 1 to 10");
    else
     System.out.println("You have entered a number from 1 to 10.");
  }

 

 

 


 

McFarland School District Home

McFarland School District

Grades: 9 - 12

Contact Information

  • McFarland High School (9-12)

    5103 Farwell Street
    McFarland, WI 53558
  • Phone

    608 838-3166
  • Fax

    608 838-4562

Social Media

  • McFarland School District Social Facebook
  • McFarland School District Social Instagram
McFarland School District Mark

© 2025 McFarland School District

  • Non-Discrimination Statement
CMS4Schools