CodeGym
Promotion
CodeGym University
Learning
Course
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme
Start learning now
  • All questions
Henry
Level 6
Stuttgart
  • 04.09.2019
  • 911views
  • 2comments

confused and need help

Question about the task The humble programmer
Java Syntax,  Level 3,  Lesson 8
Under discussion

Use the keyboard to enter a name and display the following:
<name> makes $120,000 a year. Ha-ha-ha!

For example:
Sara makes $120,000 a year. Ha-ha-ha!

Requirements:
  • The program should output text.
  • The program must read data from the keyboard.
  • The displayed text must contain the entered name.
  • The displayed text must fully match the task conditions.
package com.codegym.task.task03.task0320; /* The humble programmer */ import java.io.*; public class Solution { public static void main(String[] args) throws Exception { //write your code here BufferedReader name= new BufferedReader(new InputStreamReader(System.in)); String Sara= name.readLine(); System.out.print("Sara makes $120,000 a year. Ha-ha-ha!"); } }
0
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Ejwere
Level 16 , Houston, United States
12 September 2019, 17:26useful
check your actual print statement, your putting your variable as a string literal and not a variable. it needs to look something along the lines of
System.out.print(Sara + "makes... etc etc..");
// note the position of the quotation marks
sara is not a good variable name anyway, especially if its the solution. it should also not be capitalized, that can confuse it for a class to other programmers.
+1
Pavel Klochkov
Level 6 , Amsterdam , Netherlands
5 September 2019, 07:10useful
Hey! On line 16 you include a text instead of a variable. Check it.
+1
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Game Projects
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning and Java developer’s career.
Follow us
Interface language
Programmers Are Made, Not Born © 2023 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2023 CodeGym
This website uses cookies to provide you with personalized service. By using this website, you agree to our use of cookies. If you require more details, please read our Terms and Policy.