20182301 2019-2020-1 "Object-oriented programming and data structures" Report Experiment 2

20182301 2019-2020-1 "Object-oriented programming and data structures" Report Experiment 2

Course: "Programming and Data Structures"
Class: 1823
Name: Zhao Pei Ning
Student ID: 20182301
experiments Teacher: Johnny
experiment Date: September 16, 2019
Compulsory / Elective: Compulsory

1. Experimental content

  • Write a simple calculator, complete arithmetic modulo operation.
  • It requires two numbers input from the keyboard, using the decision statement to select an operation after the calculation result output, then it is determined to continue to select and calculate the loop or exit.
  • Write test code, test verification. ( Https://www.cnblogs.com/rocedu/p/4472842.html )

2. Experimental procedure and results

  1. Write down the code calculator use while, switch, case, break; statement.
  2. Because of the need to test the code, it is rewritten to subroutine code. Photo (1):

  3. Write test code-based functions. Photo (2):

  4. Finally, upload the code:

3. Experimental problems encountered in the process and settlement process

  • Question 1: Putting while in, int can not be converted to boolean. Photo (Error 1):

  • Problem 1 Solution: First, use Boolean type in brackets while. Second, I need to understand the real usage of Boolean:
    1. Boolean statement can be judged for if, while.
    2. Thus, while this is not used 0 or 1. Example: Boolean bool = true; input.equalsIgnoreCase ( "yes").
    3. ps: use while (rs.next ()) database traversal
  • Question 2: Can not find the main function sub-function display: can not find symbol. Photo (Error 5):

  • Problem 2 Solution: the main function, sub-function of java files and class files added to a file.
  • Question 3: case can not get git appeared many times on my computer, so to sum up:
  • Question 3 solutions:
    1. Input: git add; git commit -m ""; git push.. Then there will be:
    2. Input: git init; git remote add origin plus links; git fetch origin; git merge origin / master.
    3. vim screen appears, asking why you want to merge: free to fill in.
    4. git push -u origin master

Other (perception, thinking, etc.)

  • This experiment made me deeply appreciate the importance of prep. Because the experimental design to some of the content of Chapter IV, so in the course of the experiment is not very smooth. After the experiment I will try to preview and preview thorough.
  • Programming is justified. When writing code to have a clear idea, otherwise there will be many obstacles, changes will be very troublesome.

Reference material

Guess you like

Origin www.cnblogs.com/zhaopeining/p/11537322.html