CSC 1302 Principles of Computer Science II Lab 4: Loops and String Practice

$30.00

Category: Tags: , , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (7 votes)

Purpose:
In this assignment, you will practice how to use while-loop and scanner class in Java. When
defining your methods, you will use loops and operations on numbers/strings to complete some
specific tasks.
Task1:
Write a java program called CountDigits that has two methods: main() and int countDigit(int n)
. The main() ask user to input a number and call countDigit(int n) to print the number of digits
in the inputted number.
Sample Expected Output of Task 1:
Task2: Write a java program to use scanner class to input your full name. If the input is a legit
name that doesnot start with numbers (hint, using charAt and ASCII code), printout the length of
the input name.
Sample Expected Output of Task 2:
Criteria:
1. Upload all of the .java and the .class files to the CSc1302 dropbox on http://
icollege.gsu.edu.
2. Your assignment will be graded based on the following criteria: (a) Are your programs
runnable without errors? (b) Do your programs complete the tasks with specified outputs?
(c) Do you follow the specified rules to define your methods and programs? (d) Do you
provide necessary comments include the programmer information, date, title of the
program and brief description of the program.
3. Please comment the important lines in the .java file as shown in the template. The
important lines including but not limited to i) variables, ii) for-loop, iii) while-loop, iv)
if-else statement, iv) methods. Please use your own words to describe what is your
purpose to write this line. A .java file without comment will be graded under a 40%
penalty.
4. Make sure that both the .java and .class files are named and uploaded to icollege
correctly. If any special package is used in the program, be sure to upload the package
too. Should you use any other subdirectory (whatsoever) your program would not be
graded, and you will receive a 0 (zero).
5. No copying allowed. If it is found that students copy from each other, all of these
programs will get 0.