Operations All instructions in this section should be carried out in the class PrimitiveOperations, in the main method, and must be in the respective order Declare and initialize two variables, an integer type (byte, short, int, or long) and a floating-point value (float or double). O The names and values of the variables can be your choice, both for this step and all other steps. o Make sure that the numbers you choose can be stored within the respective primitive type you choose. O Print each of these values out on their own line using System.out.println(). Multiple these two variables together and assign the product to a new variable, ensuring that no data is lost (i.e., when multiplying 5 and 3.5, the answer should be 17.5). o Print out this new value. Use casting to convert the integer from the first step to a floating-point value and store that in another new variable. o Print out the value. Use casting to convert the floating-point value from the first step to an integer type and store that in a new variable. O Print out the value. Shifting focus, declare a char variable and assign an uppercase letter to it. O Print out this value. Using a numerical operation, change the letter to the same letter, but in lowercase. o Use a numerical operation- do not simply reassign the variable. O Hint: You may want to review a table of ASCII values for this part, and you will likely have to use casting to get this to work.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
Section 2: String Methods
All instructions in this section should be carried out in the class StringOperations, in the main method, and
must be in the respective order
• Create a new String object and assign it your name.
o Print it out.
Replace the first letter of the String with 'A'. Next, replace the last letter of the String with 'Z'.
o Recall: In Java, Strings are immutable, meaning you cannot change a String in-place.
o Do NOT just hard-code a new String with the first and last letters changed.
o Print out the result.
Lastly, let's work with some URLS. Declare a new String and give it the value of a web address.
o The web address should be in the form www.name.tld, such as www.gatech.edu or
www.stackoverflow.com
o Print out this address.
This last operation could be a little tricky. Create a substring of the variable that only consists of the
"name" part of the URL, then concatenate the integer "1331" to the end.
o For example, www.gatech.edu would become gatech1331.
o Again, do not hard-code the new String value.
Hint: The String class has a .length() method which you will likely find useful here but is not
necessary.
Print out this result.
Transcribed Image Text:Section 2: String Methods All instructions in this section should be carried out in the class StringOperations, in the main method, and must be in the respective order • Create a new String object and assign it your name. o Print it out. Replace the first letter of the String with 'A'. Next, replace the last letter of the String with 'Z'. o Recall: In Java, Strings are immutable, meaning you cannot change a String in-place. o Do NOT just hard-code a new String with the first and last letters changed. o Print out the result. Lastly, let's work with some URLS. Declare a new String and give it the value of a web address. o The web address should be in the form www.name.tld, such as www.gatech.edu or www.stackoverflow.com o Print out this address. This last operation could be a little tricky. Create a substring of the variable that only consists of the "name" part of the URL, then concatenate the integer "1331" to the end. o For example, www.gatech.edu would become gatech1331. o Again, do not hard-code the new String value. Hint: The String class has a .length() method which you will likely find useful here but is not necessary. Print out this result.
Section 1: Primitive Operations
All instructions in this section should be carried out in the class PrimitiveOperations, in the main method, and
must be in the respective order
• Declare and initialize two variables, an integer type (byte, short, int, or long) and a floating-point value
(float or double).
o The names and values of the variables can be your choice, both for this step and all other steps.
o Make sure that the numbers you choose can be stored within the respective primitive type you
choose.
o Print each of these values out on their own line using System.out.println().
Multiple these two variables together and assign the product to a new variable, ensuring that no data is
lost (i.e., when multiplying 5 and 3.5, the answer should be 17.5).
O Print out this new value.
• Use casting to convert the integer from the first step to a floating-point value and store that in another
new variable.
o Print out the value.
• Use casting to convert the floating-point value from the first step to an integer type and store that in a
new variable.
o Print out the value.
• Shifting focus, declare a char variable and assign an uppercase letter to it.
O Print out this value.
Using a numerical operation, change the letter to the same letter, but in lowercase.
o Use a numerical operation - do not simply reassign the variable.
o Hint: You may want to review a table of ASCII values for this part, and you will likely have to use
casting to get this to work.
Print out the new char value.
Transcribed Image Text:Section 1: Primitive Operations All instructions in this section should be carried out in the class PrimitiveOperations, in the main method, and must be in the respective order • Declare and initialize two variables, an integer type (byte, short, int, or long) and a floating-point value (float or double). o The names and values of the variables can be your choice, both for this step and all other steps. o Make sure that the numbers you choose can be stored within the respective primitive type you choose. o Print each of these values out on their own line using System.out.println(). Multiple these two variables together and assign the product to a new variable, ensuring that no data is lost (i.e., when multiplying 5 and 3.5, the answer should be 17.5). O Print out this new value. • Use casting to convert the integer from the first step to a floating-point value and store that in another new variable. o Print out the value. • Use casting to convert the floating-point value from the first step to an integer type and store that in a new variable. o Print out the value. • Shifting focus, declare a char variable and assign an uppercase letter to it. O Print out this value. Using a numerical operation, change the letter to the same letter, but in lowercase. o Use a numerical operation - do not simply reassign the variable. o Hint: You may want to review a table of ASCII values for this part, and you will likely have to use casting to get this to work. Print out the new char value.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY