Hi, I keep getting same error when I run this code. Can someone please help what I have to fix to make this work? Thank

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Hi, I keep getting same error when I run this code. Can someone please help what I have to fix to make this work? Thank

Post by answerhappygod »

Hi, I keep getting same error when I run this code. Can someoneplease help what I have to fix to make this work? Thank you.
Hi I Keep Getting Same Error When I Run This Code Can Someone Please Help What I Have To Fix To Make This Work Thank 1
Hi I Keep Getting Same Error When I Run This Code Can Someone Please Help What I Have To Fix To Make This Work Thank 1 (156.71 KiB) Viewed 40 times
New + TalkerTester.java Talker.java 2.8.6 Speaking TalkerTester.java X Talker.java X 1 public class Talker 2 - { 3 4 5 6 7- 8 9 10 11 12 13 | ± ហង់ ធ ឌ ឌ ន ជ ន នដន់ ន ន ន ន គន់ គ 14 15 16- 17 18 19 20 21 22 23 24 25- 26 27 28 29 30 31- 32 private String speech; // Constructor public Talker (String startingText) { speech startingText; } // Returns the text in all uppercase letters // Find a method in the JavaDocs that // will allow you to do this with just // one method call public String outdoorVoice() { } { = } // Returns the text in all lowercase letters // Find a method in the JavaDocs that // will allow you to do this with just // one method call public String indoorVoice() return speech. toUpperCase(); { Submit + Continue Save return speech. to LowerCase(); // Reset the instance variable to the new text public void setSpeech (String text) speech text; = Output . . Test Cases . Docs 5 points Status: Not Submitted The class Talker is a class that holds a piece of text. It has one instance variable, a String called speech that holds some text. It has a few methods Assignment Grade More Visible to Teachers Only Edit Assignment Settings outdoorVoice: Returns a String with the text in all uppercase letters (but does not change the instance variable!) indoorVoice: Returns a String with the text in all lowercase letters (but does not change the instance variable!) setSpeech : Updates the instance variable speech toString: Returns a String representation of the object. This String should look like "Text goes here," said the talker. To implement these methods, find a couple of methods in the Java Docs that will allow you to make a String all uppercase or all lowercase letters. You can find the String documentation here: https://docs.oracle.com/javase/7/docs/a ... tring.html Scroll down to the Method Summary and look through the methods that you can call on String objects. Click on the method name to see more information about the method.
8 ☀ New + TalkerTester.java Talker.java 2.8.6 Speaking TalkerTester.java X 15 16 - 17 ∞ √ 18 19 20 21 22 23 24 25- 26 27 28 29 30 31- 32 33 34 35 36 37 38 39 40 41 42 43 - Talker.java X public String outdoorVoice() { } // Returns the text in all lowercase letters // Find a method in the JavaDocs that // will allow you to do this with just // one method call public String indoorVoice() { } // Reset the instance variable to the new text public void setSpeech (String text) { speech = text; } // Returns a String representatin of this object // The returned String should look like // // "Text goes here," said the talker 44 45 46 } return speech. toUpperCase(); return speech. to LowerCase(); Submit + Continue Save // The quotes should appear in the String // The text displayed should be the value of the instance variable public String toString() { return "\"" + text +"\"" + "said the talker"; }
New + TalkerTester.java Talker.java 2.8.6 Speaking TalkerTester.java X 1 import java.util.Scanner; 2 3 public class Talker Tester 4- { 5 6- 7 8 9 10 11 12 BEHEERANN 13 14 15 16 17 18 19 20 21 22} Talker.java X public static void main(String[] args) { } Scanner input = new Scanner(System.in); System.out.println("Enter some text: "); String words=input.nextLine(); Talker talky = new Talker(words); String yelling = talky. outdoorVoice(); String whispers = talky.indoorVoice(); System.out.println(talky); System.out.println("Yelling: " + yelling); System.out.println("Whispering: + whispers); Submit + Continue Save Output ▶ Run Test Cases Stop Docs Check Code Assignment Talker.java:44: error: cannot find symbol variable text symbol: location: class Talker 1 error Grade return "\"" + text +"\"" + "said the talker"; More
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply