Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
3rd Edition
ISBN: 9780134038179
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 7, Problem 5FTE
Explanation of Solution
Given code:
// String array creation
String[] words = { "Hello", "Goodbye" } ;//Line 1
// Convert the array value to uppercase
System.out.println(words.toUpperCase());//Line 2
Errors in the given code:
The error is present in the Line 2,
- In the statement to convert string to uppercase characters, the keyword “words” refers to the array name.
- But, to convert string array case to uppercase character, subscript of the array should be used...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What sort algorithm is implemented in the sortArray1 method in the
following program segment? *
int* p:
int a[3]{1, 2, 3};
p = a;
What is the value of *(p+2)?
function performTask () {
var valuel;
valuel - document.getElementById ("FirstBox").value;
if (valuel == "Yes") {
document.getElementById ("paragraphl").innerHTML = "Agreed";
) else if (valuel =- "No") {
document.getElementById ("paragraphl").innerHTML = "Sorry";
) else (
alert ("Error")
Describe the purpose of the following JavaScript statements from the function
performTask ().
i. alert("Error"),
ii. value1 = document.getElementByld("FirstBox").value;
iii. document.getElementByld("paragraph1").innerHTML = "Agreed";
Chapter 7 Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Ch. 7.1 - Write statements that create the following arrays:...Ch. 7.1 - Whats wrong with the following array declarations?...Ch. 7.1 - Prob. 7.3CPCh. 7.1 - Prob. 7.4CPCh. 7.1 - Prob. 7.5CPCh. 7.1 - Prob. 7.6CPCh. 7.1 - Prob. 7.7CPCh. 7.1 - Prob. 7.8CPCh. 7.2 - Prob. 7.9CPCh. 7.2 - Prob. 7.10CP
Ch. 7.2 - A program has the following declaration: double[]...Ch. 7.2 - Look at the following statements: int[] a = { 1,...Ch. 7.3 - Prob. 7.13CPCh. 7.3 - Write a method named zero, which accepts an int...Ch. 7.6 - Prob. 7.15CPCh. 7.7 - Recall that we discussed a Rectangle class in...Ch. 7.10 - Prob. 7.17CPCh. 7.11 - What value in an array does the selection sort...Ch. 7.11 - How many times will the selection sort swap the...Ch. 7.11 - Prob. 7.20CPCh. 7.11 - Prob. 7.21CPCh. 7.11 - If a sequential search is performed on an array,...Ch. 7.13 - What import statement must you include in your...Ch. 7.13 - Write a statement that creates an ArrayList object...Ch. 7.13 - Write a statement that creates an ArrayList object...Ch. 7.13 - Prob. 7.26CPCh. 7.13 - Prob. 7.27CPCh. 7.13 - Prob. 7.28CPCh. 7.13 - Prob. 7.29CPCh. 7.13 - Prob. 7.30CPCh. 7.13 - Prob. 7.31CPCh. 7 - Prob. 1MCCh. 7 - Prob. 2MCCh. 7 - Prob. 3MCCh. 7 - Prob. 4MCCh. 7 - Array bounds checking happens. a. when the program...Ch. 7 - Prob. 6MCCh. 7 - Prob. 7MCCh. 7 - Prob. 8MCCh. 7 - Prob. 9MCCh. 7 - Prob. 10MCCh. 7 - Prob. 11MCCh. 7 - To delete an item from an ArrayList object, you...Ch. 7 - Prob. 13MCCh. 7 - Prob. 14TFCh. 7 - Prob. 15TFCh. 7 - Prob. 16TFCh. 7 - Prob. 17TFCh. 7 - Prob. 18TFCh. 7 - True or False: The Java compiler does not display...Ch. 7 - Prob. 20TFCh. 7 - True or False: The first size declarator in the...Ch. 7 - Prob. 22TFCh. 7 - Prob. 23TFCh. 7 - int[] collection = new int[-20];Ch. 7 - Prob. 2FTECh. 7 - Prob. 3FTECh. 7 - Prob. 4FTECh. 7 - Prob. 5FTECh. 7 - Prob. 1AWCh. 7 - Prob. 2AWCh. 7 - Prob. 3AWCh. 7 - In a program you need to store the populations of...Ch. 7 - In a program you need to store the identification...Ch. 7 - Prob. 6AWCh. 7 - Prob. 7AWCh. 7 - Prob. 8AWCh. 7 - Prob. 9AWCh. 7 - Prob. 10AWCh. 7 - Prob. 11AWCh. 7 - Prob. 1SACh. 7 - Prob. 2SACh. 7 - Prob. 3SACh. 7 - Prob. 4SACh. 7 - Prob. 5SACh. 7 - Prob. 6SACh. 7 - Prob. 7SACh. 7 - Prob. 8SACh. 7 - Prob. 9SACh. 7 - Rainfall Class Write a RainFall class that stores...Ch. 7 - Payroll Class Write a Payroll class that uses the...Ch. 7 - Charge Account Validation Create a class with a...Ch. 7 - Charge Account Modification Modify the charge...Ch. 7 - Prob. 5PCCh. 7 - Drivers License Exam The local Drivers License...Ch. 7 - Magic 8 Ball Write a program that simulates a...Ch. 7 - Grade Book A teacher has five students who have...Ch. 7 - Grade Book Modification Modify the grade book...Ch. 7 - Average Steps Taken A Personal Fitness Tracker is...Ch. 7 - Array Operations Write a program with an array...Ch. 7 - 12.1994 Gas Prices In the student sample programs...Ch. 7 - Sorted List of 1994 Gas Prices Note: This...Ch. 7 - Name Search If you have downloaded this books...Ch. 7 - Population Data If you have downloaded this books...Ch. 7 - World Series Champions If you have downloaded this...Ch. 7 - 2D Array Operations Write a program that creates a...Ch. 7 - Prob. 18PCCh. 7 - Trivia Game In this programming challenge, you...Ch. 7 - Prob. 20PC
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Trace through the following program and show the output. Show your work for partial credit. public class Employee { private static int empID = 1111l; private String name , position; double salary; public Employee(String name) { empID ++; this.name 3 пате; } public Employee(Employee obj) { empID = obj.empĪD; пате %3D оbj.naте; position = obj.position; %3D public void empPosition(String empPosition) {position = empPosition;} public void empSalary(double empSalary) { salary = empSalary;} public String toString() { return name + " "+empID + " "+ position +" $"+salary; public void setName(String empName){ name = empName;} public static void main(String args[]) { Employee empOne = new Employee("James Smith"), empTwo; %3D empOne.empPosition("Senior Software Engineer"); етрOпе.етpSalary(1000); System.out.println(empOne); еmpTwo empTwo.empPosition("CEO"); System.out.println(empOne); System.out.println(empTwo); %3D етpОпе empOne ;arrow_forwardAssume that the following program segment is executed. What is the last element of testArray2 after the execution of the statement sortArray1(testArray2);? *arrow_forwardPLEASE HELP ME! ? Maximize and use alternative method to this code! package com.btech.pf101; import java.io.bufferedreader; import java.io.inputstreamreader; import java.util.calendar; import java.util.date; public class pawnshopcode { private static final bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); private static string name; private static int age; private static string address; private static string contactno; private static int itemtype; private static string itemtypename; private static final int itemtype_gagdet = 1; private static final int itemtype_jewelry = 2; private static final int itemtype_musicinstrument = 3; private static final int itemtype_homeequipment = 4; private static final int itemtype_landtitle = 5; private static string itemdescription; private static int periodtype; private static string periodtypename; private static final int periodtype_days = 1; private…arrow_forward
- function myChoice(items) {if (!this.value && !this.items) {this.items = items[0];} else if (!this.value || (params.length > 0 && params[0] == "rechoose")) {let index = Math.floor(Math.random() * (this.items.length - 0)) + 0;this.value = this.items[index];return this.value;}return this.value;} var a = myChoice([1, "a", 3, false]);console.log(myChoice(3, 12));console.log(myChoice(51, -2));console.log(myChoice("happy", false));console.log(myChoice([1, 2, 3]));console.log(myChoice("rechoose"));console.log(myChoice(a, a)); these are directions and examples myChoice( items ) This function accepts a list of items as input and creates a function that returns a randomly-chosen item. After choosing a random item, that same item will be always be returned, regardless of the functions input, with one exception. If the first input is the string 'rechoose', then a new random item will be chosen and therafter returned. this is KEYYYY!! Examples var a = myChoice( [1, "a", 3, false]…arrow_forwardComplete the code: string cars[5] = {"Volvo", "BMW", "Ford", "Mazda", "Honda"}; for(int i = 0; i < - ; i++) { cout << cars[i]< "\n"; } %3Darrow_forward#include void main () { int a=5,b=10,c=1; if (a && b>c) { printf("cquestionbank"); } else{ break; } }arrow_forward
- a) FindMinIterative public int FindMin(int[] arr) { int x = arr[0]; for(int i = 1; i < arr.Length; i++) { if(arr[i]< x) x = arr[i]; } return x; } b) FindMinRecursive public int FindMin(int[] arr, int length) { if(length == 1) return arr[0]; return Math.Min(arr[length - 1], Find(arr, length - 1)); } What is the Big-O for this functions. Could you explain the recurisive more in details ?arrow_forwardusing System; class Program { publicstaticvoid Main(string[] args) { int number = 1; while (number <= 88) { Console.WriteLine(number); number = number + 2; } int[] randNo = newint[88]; Random r = new Random(); int i=0; while (number <= 88) { randNo[i] = number; number+=1; i+=1; } for (i = 0; i < 3; i++) { Console.WriteLine("Random Numbers between 1 and 88 are " + randNo[r.Next(1, 88)]); } } } this code counts from 1-88 in odds and then selects three different random numbers. it keeps choosing 0 as a random number everytime. how can that be fixed?arrow_forwardusing System; class Program { publicstaticvoid Main(string[] args) { int number = 1,i; while (number <= 88) { Console.WriteLine(number); number = number + 2; { Random r = new Random(); int[] randNo=newint[3]; for(i=0;i<3;i++) { randNo[i]= r.Next(1,88) Console.WriteLine("Random Number between 1 and 88 is "+randNo); } } } } } how can this program be fixed to choose three random numbers in C# between 1-88 instead of just one random number?arrow_forward
- Given: String[] name={"John", "Mary", "Jim", "Sam"}; Which one is correct: name[1]="Mary" name[1]="John" name.get(1)="Mary" name.get(1)="John"arrow_forwardQuestion - 2) Create a C# Console application(DOT net framework) using Visual Studio IDE. Project name should include students' firstname(s) followed by A1(Example: HarleenHardeep_A1) (Submission Instruction: sumbit the Zipped project folder) In this project. Rename Program.cs to A1Q2.cs. In A1Q2.cs do the following tasks: Step 1 Declare variables of different data types (at least 10 variables). Assign valid literals to those variables. Step 2) Step 3) Print the values of the variables using format strings and placeholders in Console.Write() Console.WriteLine(). 2 | Page ASSIGNMENT 1 CSD 2354 (C#) Print values of some variables in following formats: i) Currency Number Hexadecimal, iv) Percentage. Embed comment lines before each Console.WriteLine and explain, how the format strings and placeholders work. Perform some arithmetic operations on the variables you declared in step 1. You should demonstrate the use of following arithmetic operations +,-,/, * and % Demonstrate the use of…arrow_forward// Makes String comparisons public class DebugSeven1 { publicstaticvoidmain(String[] args) { String name1 ="Roger"; String name2 ="Roger"; String name3 ="Stacy"; if(name1.equals(name2)) System.out.println(name1 + " and " + name2 + " are the same"); if(name1.equals(name3)) System.out.println(name1 + " and " + name2 + " are the same"); if(name1.equals("roger)); System.out.println(name1 + " and 'roger' are the same"); if(name1.equals("Roger")); System.out.println(name1 + " and 'Roger' are the same"); } }arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,