CSci 1101 Lab 4. Due Friday Feb. 17th at 10pm

Reminder about sftp

This is just a reminder of basic sftp commands.

If/else exercise

Here is the starting code for this program:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
Exercise on if/else statements
Author: Elena Machkasova
Last modified: 2/13/06
$date = $_GET["input"]; // Assuming February 2006
Days of the week
// Sally has a Computer Science class on Tuesdays and Thursdays 
// and Biology on Mondays, Wednesdays, Fridays
// Assuming that $date has the date in February 2006, 
// Make the page print what class she has on a given day, or,
// if it's a weekend, print "Have a nice weekend"

if ( ($date % 7) == 0) {
	print "Today is Tuesday<br/>\n";	// a sample code - need 
	                                        // to change

Your task for this question is to make the program behave as written in the comments. Note that the sample output in the above program is not what's required: you don't need to print out the days of the week, instead you need to say what classes Sally has on the day given as an input or whether it's a weekend.

Some hints:

  1. Use || to combine the conditions. For instance, Sally has a Computer Science class if it's Tuesday or Thursday.
  2. Upload your program to rynite. To test it, type in the path to it and add the input at the end of the URL, for instance ?input=17. Make sure to try your program with different inputs.
  3. If your program is not working, check it carefully. Make sure that all parentheses, brackets, and quotation marks are closed, check the semicolon at the end of each print statement, and make sure that you follow the right format for the if/else or if/elseif statement.
  4. If your program doesn't work and you can't find a mistake, please ask me.
  5. For those who weren't in the lab: When you are done, send me an e-mail with the file name.

This page is a part of CSci 1101 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.