Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
CS 1301 
Lab 1 
 
Simple Java Programs – Chapter 1 
 
Use JGrasp to write Java programs to print out the following outputs. 
 
For each lab program you develop during this course, make sure that include the following header - replace the dots 
in the header with your section #, semester, your full name, your instructor’s name, and lab #: 
 
// Class:      CS 1301/... 
// Term:       ...  
// Name:       ... 
// Instructor: ... 
// Lab#:       ... 
 
 
Exercise 1:  Write a Java program (name it Practice_1_1) to print out on separate lines the following: your name, 
your birthday, your hobbies, your favorite book, and your favorite movie. Label each piece of information in the output. 
 
 
Exercise 2:  Write a Java program (name it Practice_1_2) to print out the following shape using stars:  
  
               *  
              * *  
             * * *  
            * * * *  
             * * *  
              * *  
               *  
 
Exercise 3:  Write a java program (name it Practice_1_3) to display the result of  
 
                      1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10  
 
Exercise 4:  Write a java program (name it Practice_1_4) to display the area and perimeter of a rectangle with 
width = 4 and height = 8. Use proper labels for the outputs. 
 
 
Exercise 5:  Study Chapter 1, section 10: Programming Errors, page 20.  
 
1. Type, compile, and run the program in Listing 1.4, page 20. Observe the syntax errors understand them. 
2. Type, compile, and run the program in Listing 1.5, page 21. Observe the run-time error and understand why it 
happened. 
3. Type, compile, and run the program in Listing 1.6, page 22. Observe the output and understand why the code 
gave the wrong output (due to logical error). 
 
 
Instructions: 
 
1.  Programs must be working correctly. 
2.  Programs must be completed and checked before working assignment #1. 
3.  Programs must be checked by the end of the designated lab session.