0
How do you split multiple inputs into separate lines?
Looks like your program needs input Split multiple inputs into separate lines https://code.sololearn.com/cf2A18ZMM3z3/?ref=app
7 Answers
+ 3
For further help post your code. We will help you more to get your requirements
+ 2
Samuel Ganda
If you want to take multiple input in Sololearn then just take inputs in seperate lines and press enter.
Like :
123
AJ
In your code, there should be two input statement like.
int id = scanner.nextInt();
String name = scanner.next();
If there are 3 input then there should be 3 input statement and so on.
Notes: You have imported scanner class wrongly. Every imported class should be on above the class name means it should be always on top in Java.
+ 1
Type first input, press enter and type another input.
0
"import java.util.Scanner;" should be the very first
0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sololearn
{
class Program
{
static void Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8 ;
Console.InputEncoding = Encoding.UTF8 ;
string tenNhanVien ;
int soNguoiPhuThuoc ;
double luong;
double thuNhapChiuThue ;
double thueXuat ;
Console.Write("Nhập tên nhân viên: ");
NguoiPhuThuoc:
Console.Write("Nhập số người phụ thuộc:");
//soNguoiPhuThuoc = int.Parse(Console.Readline());
if(!int.TryParse(Console.ReadLine(), out soNguoiPhuThuoc )){
Console.Write ("Bạn đã nhập sai.") ;
goto NguoiPhuThuoc;
}
Luong:
Console.Write ("Nhập số lương: ");
if(!double.TryParse(Console.ReadLine(),out luong )){
Console.Write("Bạn đã nhập sai.");
goto Luong;
}
thuNhapChiuThue = luong - 11 - soNguoiPhuThuoc*4.4 ;
if(thuNhapChiuThue < 60)
thueXuat = thuNhapChiuThue * 0.05 ;
else if (thuNhapChiuThue >= 60 && thuNhapChiuThue <120)
thueXuat = thuNhapChiuThue * 0.1;
}
}
}
When I press run it shows like this: (Looks like your program needs input
Split multiple inputs into separate lines)
Then how to enter it so it runs correctly?