Preview

E-Commerce Exercise

Better Essays
Open Document
Open Document
1068 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
E-Commerce Exercise
Characters, Strings, and the StringBuffer

Quick Quiz 1

1. As an object, a String variable name is not a simple data type. It is a(n) ____; that is, a variable that holds a memory address.

1. The ____ method of the Character class returns true if the argument is a digit (0–9) and false otherwise.

2. What is the value of result in the following program code? char aChar = 'C'; Boolean result = Character.isWhitespace(aChar);

Quick Quiz 2

1. True or False: The class String is defined in java.lang.String, which is automatically imported into every program you write.

2. Strings and other objects that can’t be changed are known as ____.

3. The String class ____ method evaluates the contents of two String objects to determine if they are equivalent.

4. The ____ method requires an integer argument that indicates the position of the character that the method returns.

Quick Quiz 3

1. To convert a String to an integer, you use the Integer class, which is part of ____ and is automatically imported into programs you write.

2. A method of the Double class is the ____ method, which takes a String argument and returns its double value.

3. True or False: You can change the length of a String in a StringBuffer object with the setLength() method.

Class Discussion Topics

1. Why do you think Java provides primitive data types AND wrapper classes for them? Why not just one or the other?

2. Under what circumstances would you choose to use the String class? When would you use StringBuffer?

Additional Projects

1. Create a program that prompts the user to enter two Strings. Then display the Strings in alphabetical order. If the two Strings are equal, display a message that they are equal rather than printing them in alphabetical order.

2. In addition to the methods covered in this chapter, Java provides a number of classes used to convert and format

You May Also Find These Documents Helpful

  • Powerful Essays

    Is505 Final

    • 1919 Words
    • 8 Pages

    5. (TCO B,C) Decide in each of the following sub-questions i and ii, whether the statement is true or false. If the statement is false, explain why it is false, and show how you will rephrase the statement to make it meaningfully true.…

    • 1919 Words
    • 8 Pages
    Powerful Essays
  • Satisfactory Essays

    Nt1310 Unit 3 Assignment

    • 256 Words
    • 2 Pages

    Write a program to input a string and then display it in Upper Case and also print the frequency of any character from the string.…

    • 256 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    3) Look at the following pseudocode module header: Module myModule( Integer a, Integer b, Integer c) Now look at the following call to myModule: Call myModule( 3, 2, 1) When this call executes, what value will be stored in a? What value will be stored in b? What value will be stored in c?…

    • 1580 Words
    • 11 Pages
    Better Essays
  • Good Essays

    Onetop Master

    • 439 Words
    • 2 Pages

    Which of the following is a correct call to a method declared as public static void aMethod(char code)?…

    • 439 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Coding: Questions

    • 2042 Words
    • 18 Pages

    In the cookie cutter metaphor, think of the ________ as a cookie cutter and ________ as the cookies.…

    • 2042 Words
    • 18 Pages
    Good Essays
  • Powerful Essays

    French Ab Past Paper

    • 1485 Words
    • 8 Pages

    QUESTION AND ANSWER BOOKLET – INSTRUCTIONS TO CANDIDATES • • • • • • • Write your session number in the boxes above. Do not open this booklet until instructed to do so. This booklet contains all the Paper 1 questions (Text handling and written response). Refer to the Text Booklet which accompanies this booklet. Answer all of the questions in the spaces provided. Each text handling question is allocated [1 mark] unless otherwise stated. The written response is allocated [10 marks].…

    • 1485 Words
    • 8 Pages
    Powerful Essays
  • Powerful Essays

    Practice Assignment 1

    • 2761 Words
    • 26 Pages

    This guided example, will not provide a solution for programming assignment 1. However, it will guide you…

    • 2761 Words
    • 26 Pages
    Powerful Essays
  • Satisfactory Essays

    It Theory Question Paper

    • 2478 Words
    • 10 Pages

    Various options are given as possible answers to the following questions. Choose the correct answer and write only the capital letter (A-D) in print next to the question number (1.1-1.10); e.g. 1.11 C.…

    • 2478 Words
    • 10 Pages
    Satisfactory Essays
  • Powerful Essays

    Hrm Dsdvsd

    • 2401 Words
    • 10 Pages

    contain a string, a number, an enumeration symbol or a list. A list item may be any of the…

    • 2401 Words
    • 10 Pages
    Powerful Essays
  • Satisfactory Essays

    Java Test

    • 469 Words
    • 2 Pages

    Q3. “ X extends Y “ is correct if and only if X is a class and Y is an interface.…

    • 469 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    3. Create a program that determines if the input numbers is a magic number (143) which is equivalent to the magic word: “I LOVE YOU”, if it is equivalent, then display the message.”Right” otherwise display the message. ”Wrong”.…

    • 1323 Words
    • 6 Pages
    Good Essays
  • Satisfactory Essays

    C# String Functions

    • 325 Words
    • 2 Pages

    5. Format - Replaces one or more format items in a specified string with the string representation of a specified object.…

    • 325 Words
    • 2 Pages
    Satisfactory Essays
  • Best Essays

    Thinkcspy CEP Textbook

    • 131187 Words
    • 952 Pages

    2.10 Input . . . . . . . . . . . . . . .…

    • 131187 Words
    • 952 Pages
    Best Essays
  • Satisfactory Essays

    Introduction to programming 1 Tutorial letter 102 for COS1511 Solutions to exercises in the Study Guide…

    • 289 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    what it is, how and when to use each piece of code. First, let’s understand String Handling.…

    • 1366 Words
    • 6 Pages
    Good Essays

Related Topics