CMPS 200 Homework Assignment 1, Fall 2016

American University of Beirut · Introduction to Programming · 3 pages · Dr. Ahmad Dhaini

All CMPS 200 files
CMPS 200 Homework Assignment 1, Fall 2016, page 1

Stuck on a question? A tutor can walk you through it.

CMPS 200 Homework Assignment 1, Fall 2016, page 2 CMPS 200 Homework Assignment 1, Fall 2016, page 3

More CMPS 200 files

Show the text of this homework
Faculty of Arts & Sciences Department of Computer Science CMPS 200—Introduction to Programming Assignment 1 – Due: Sep. 12, 2016 @ 02:00 pm Fall 2016-17 1 of 3 Notes on the Development Environment • In order to compile and run your programs you will need a compiler (javac) and a runtime virtual machine (java). Both tools are part of the Java Development Environment (JDK). • The JDK is installed on all lab machines in Bliss. Those of you who plan to write your programs on your own laptops and desktops should download the appropriate version of JDK 8 from Moodle. • Detailed instructions for installation of the JDK may be found on the Moodle site as well. Please read and follow the detailed instructions for verifying the installation. Exercise 1 Write a program Personal.java that prints your identity and personal information as follows: My name is: FirstName LastName I am born on: day/month/year My favorite hobby is: xxx My favorite sport is: xxx My favorite team is: xxx My favorite movie is: xxx Exercise 2 Write a program Rhombus.java that prints the following shape: o ooo ooooo ooooooo ooooooooo ooooooo ooooo ooo o Exercise 3 Write a program Shape.java that draws the following output (see below). Use static methods to show structure and eliminate redundancy in your solution. ________ \ / \ / \ / / \ / \ / \ ******** ________ \ / \ / \ / / \ / \ / \ ******** CMPS 200: Introduction to Programming Fall 2016-17 2 of 3 Exercise 4 Write a program Lebanon.java that prints the following logo. Use static methods to show structure and eliminate redundancy in your solution. | | | |_____ _____ | |_____ | |_____ _____ | | |_____| | | |_____| _ / \ /___\ / \ / \ . . |\ | | \ | | \ | | \| __ / \ | | | | \ __ / . . |\ | | \ | | \ | | \| Exercise 5 Write a program JavaLogo.java that displays the following pattern: J A V V A J A A V V A A J J AAAAA V V AAAAA J J A A V A A CMPS 200: Introduction to Programming Fall 2016-17 3 of 3 Exercise 6 Write a program GenerateJavaCode.java that prints Java programs (see below). Use static methods to show structure and eliminate redundancy in your solution. // Program starts here... public class Hello { public static void main(String[] args) { System.out.println("Create Programs Automatically!"); } } // Program ends here... // Program starts here... public class Hello { public static void main(String[] args) { System.out.println("print test!"); System.out.println("print hello!"); } } // Program ends here... // Program starts here... public class Hello { public static void main(String[] args) { System.out.println("print test!"); System.out.println("print hello!"); } } // Program ends here... // Program starts here... public class Hello { public static void main(String[] args) { System.out.println("Create Programs Automatically!"); System.out.println("print test!"); System.out.println("print hello!"); System.out.println("Create Programs Automatically!"); } } // Program ends here... Submission Instructions • Your submission must consist of a single zip folder that contains .java files only (Personal.java, Rhombus.java, Shape.java, Lebanon.java, JavaLogo.java, and GenerateJavaCode.java). No additional files should exist in the .zip folder. • Give meaningful names to your methods and variables in your code. • Include a comment at the beginning of your program with basic information about yourself and a description of the program. Include also a comment at the start of each method. • The name of the zip file must adhere to the following naming convention s#_A$_netid, where # stands for your section number (between 1 and 12), $ stands for the assignment number, and netid stands for your AUBnet user name. For example, if your AUBnetid is abc65 and you are in section 4, you should submit Assignment 1 using following file: s4_A1_abc65.zip. The zip files will be processed automatically so please make sure you use this naming convention. • Failing to follow these guidelines will result in deducting marks form your grade.