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
Somya Gupta
Level 4
Vrindavan
  • 28.08.2018
  • 1137views
  • 2comments

plzz wats wrong

Question about the task Predictions
Java Syntax,  Level 3,  Lesson 8
Under discussion

Use the keyboard to separately enter the name, number1, and number2.
Display the following phrase:
<name> will receive <number1> in <number2> years.

Here's an example:
Nick will receive 10000 in 5 years.

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 number1.
  • The displayed text must contain the entered number2.
  • The displayed text must fully match the task conditions.
package com.codegym.task.task03.task0319; /* Predictions */ 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)); String ans=br.readLine(); int num1=Integer.parseInt(ans); String vans=br.readLine(); int num2=Integer.parseInt(vans); String name=br.readLine(); System.out.println(name+" "+"will recive"+" "+num1+" "+"in"+num2+"years."); } }
0
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Ravi Kumar
Level 5 , Hyderabad, India
31 October 2018, 12:38
Define num2 first and then num1 and try
0
Roman
Level 41
29 August 2018, 06:10
Have you tried to run you code? Use the keyboard to separately enter the name, number1, and number2. The order is important!
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.