CodeGym
Promotion
CodeGym University
Learning
Course
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme
Question
  • Reviews
  • About us
Start
Start learning
Start learning now
  • All questions
Wilder
Level 4
Alajuela
  • 30.03.2019
  • 918views
  • 3comments

whats wrong with my code ??? :(

Question about the task Plan to conquer the world
Java Syntax,  Level 3,  Lesson 8
Under discussion


Enter the number and name from the keyboard. Display the following string:
<name> will take over the world in <number> years. Mwa-ha-ha!

Here's an example:
Kevin will take over the world in 8 years. Mwa-ha-ha!

The order in which the data is input matters a lot.

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 contain the entered number.
  • The displayed text must fully match the task conditions.
package com.codegym.task.task03.task0318; /* Plan to conquer the world */ import java.io.*; public class Solution { public static void main(String[] args) throws Exception { //write your code here BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); System.out.println("ingrese edad: "); String age= br.readLine(); int age1= Integer.parseInt(age); System.out.println("ingrese nombre: "); String name= br.readLine(); System.out.println(name+" will take over the world in "+age1+" years. Mwa-ha-ha!"); } }
0
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
JACOB ANDERSEN
Level 10 , Wilmington, United States
31 March 2019, 01:02
The instructions just tells you to input name and number. It doesn't say anything about you asking politely for them. Comment out line 19 and 25 and re-run.
+2
Guadalupe Gagnon
Level 37 , Tampa, United States
30 March 2019, 02:09useful
Lines 19 and 25 are causing you to fail. Output(s) needs to be exact.
+2
Wilder
Level 4 , Alajuela, Costa Rica
30 March 2019, 02:01
I did import java.util.Scanner , but it didn't work
0
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.