CSC 1760: Lesson 6 - Character and String Data Types and Operations - Prof. Charles W. Lil, Assignments of Computer Science

A university lesson for an introduction to programming course, specifically lesson 6, which covers char and string data types and associated operations. Students are required to write programs using scanner and input dialog to input data and convert it to the correct data type. The lesson also includes an assignment to write a program displaying unicode characters for various greek letters.

Typology: Assignments

Pre 2010

Uploaded on 08/09/2009

koofers-user-c6l
koofers-user-c6l 🇺🇸

5

(1)

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSC 1760 Introduction to Programming
Lesson 6: Character and String Data Types and Operations
Due Date: 1/26/2009
1. Textbook: Introduction to Java Programming, Brief Version, Seventh Edition,
Author: Y. Daniel Liang, 2009, Prentice Hall
a. Sections 2.9, 2.10, 2.11, 2.16
2. Overview
Demonstrate using char and String types and some of the operations associated
with them. Also, use Scanner and Input Dialog to input data. To properly input
data you will need to convert the input to the correct data type to support that
data.
3. Tasks
a. Scanner input – write a program named InputScanner.java that
demonstrates each of the following Scanner inputs:
i. nextByte() reads an integer of the byte type
ii. nextShort() reads an integer of the short type
iii. nextInt() reads an integer of the int type
iv. nextLong() reads an integer of the long type
v. nextFloat() reads an number of the float type
vi. nextDouble() reads an number of the double type
vii. next() reads a string that ends before a whitespace
viii. nextLine() reads a line of characters (a string ending with a line
separator)
You should demonstrate it works by displaying to the monitor the values
that were input.
b. Input Dialogs – repeat 3.a but use input dialogs instead of Scanner and
name the program InputDialog.java.
pf2

Partial preview of the text

Download CSC 1760: Lesson 6 - Character and String Data Types and Operations - Prof. Charles W. Lil and more Assignments Computer Science in PDF only on Docsity!

CSC 1760 Introduction to Programming

Lesson 6: Character and String Data Types and Operations

Due Date: 1/26/

  1. Textbook: Introduction to Java Programming, Brief Version , Seventh Edition, Author: Y. Daniel Liang, 2009, Prentice Hall a. Sections 2.9, 2.10, 2.11, 2.
  2. Overview Demonstrate using char and String types and some of the operations associated with them. Also, use Scanner and Input Dialog to input data. To properly input data you will need to convert the input to the correct data type to support that data.
  3. Tasks a. Scanner input – write a program named InputScanner.java that demonstrates each of the following Scanner inputs: i. nextByte() reads an integer of the byte type ii. nextShort() reads an integer of the short type iii. nextInt() reads an integer of the int type iv. nextLong() reads an integer of the long type v. nextFloat() reads an number of the float type vi. nextDouble() reads an number of the double type vii. next() reads a string that ends before a whitespace viii. nextLine() reads a line of characters (a string ending with a line separator) You should demonstrate it works by displaying to the monitor the values that were input. b. Input Dialogs – repeat 3.a but use input dialogs instead of Scanner and name the program InputDialog.java.

c. Write a program named DisplayUnicode.java to display the Unicode characters for the Greek letters (both upper case and lower case) alpha, beta, gamma, delta epsilon, zeta, eta, theta, ioa, kappa, lamda, mu, nu, omicron, pi, rho, sigma, tau, upsilon, phi, chi, psi, and omega. Note: The textbook example DisplayUnicode.java will not display the Chinese characters (\u6B22 and \u8FCE) unless the Chinese font is installed on your computer. The characters should be displayed as followed:

  1. Assignments due: a. InputScanner.java b. InputDialog.java c. DisplayUnicode.java