Click here to Skip to main content
15,908,112 members
Home / Discussions / Java
   

Java

 
PinnedForum Guidelines - PLEASE READ Pin
Chris Maunder28-Jul-09 2:36
cofounderChris Maunder28-Jul-09 2:36 
QuestionMy java output is running but the output does not follow assignment format Pin
Olivia824-Mar-24 20:18
Olivia824-Mar-24 20:18 
How can my output have the same structure/output as the sample output


Output
Technician ID: FT1001

Name: David Jonathan

Salary: 50000.0

Calculated Salary: 50000.0

 

Technician ID: PTE2001

Name: Keith Peters

Salary: 24.5

Calculated Salary: 980.0

 

Technician ID: FTE1003

Name: Mary Aramal

Salary: 60000.0

Calculated Salary: 60000.0


my output :

Output
FullTime,David Jonathan,FT1001,50000
PartTime,Keith Peters,PTE2001,24.5 
FullTime,Mary Aramal,FTE1003,60000
PartTime,Hassan Otosh ,PTE2002,30.5 
FullTime,Bernard Becker,FTE1004,40000
PartTime,Roselyn Anne,PTE2003,24.5 
FullTime,James Lead,FTE1005,80000


my main class :

Java
public static void main(String[]args) {
		String relativePath = "data/technicians.csv";
		List<BaseTechnician> technicians = new ArrayList<>();

			
			List<String[]> data = CSVReader.readTechnicians(relativePath);
			
			if(data != null) {
		
		
		for(String[]technician : data) {
			
			String position = technician[0];
			
			
			BaseTechnician emp;
			switch(position) {
			case " Fulltime ":
			 emp = new FullTimeTechnician(technician[1], technician[2],Double.parseDouble(technician[3]));
			break;
			case " PartTime ":
			 emp = new PartTimeTechnician(technician[1], technician[2],Double.parseDouble(technician[3]));
				break;
				default:
					System.out.println( position);
					continue;
					
					
			}
			technicians.add(emp);
			
			for(BaseTechnician tech : technicians ) {
				tech.displayDetails();
				
			}
			
		}
		} else {
			System.out.println("Error Failed to read data from the technician CSV file ");
		}
		
	}
	
	
}

AnswerRe: My java output is running but the output does not follow assignment format Pin
OriginalGriff24-Mar-24 20:24
mveOriginalGriff24-Mar-24 20:24 
QuestionJava assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
Olivia824-Mar-24 6:23
Olivia824-Mar-24 6:23 
AnswerRe: Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
OriginalGriff24-Mar-24 6:28
mveOriginalGriff24-Mar-24 6:28 
GeneralRe: Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
Olivia824-Mar-24 10:11
Olivia824-Mar-24 10:11 
GeneralRe: Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
OriginalGriff24-Mar-24 20:19
mveOriginalGriff24-Mar-24 20:19 
GeneralRe: Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
jschell26-Mar-24 12:03
jschell26-Mar-24 12:03 
AnswerRe: Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
jimakoskx24-Mar-24 22:30
jimakoskx24-Mar-24 22:30 
GeneralSecurity Manager gone Pin
jschell20-Mar-24 12:52
jschell20-Mar-24 12:52 
Questionlarge numbers Pin
mike741114-Jan-24 12:58
mike741114-Jan-24 12:58 
AnswerRe: large numbers Pin
Pete O'Hanlon14-Jan-24 20:47
mvePete O'Hanlon14-Jan-24 20:47 
AnswerRe: large numbers Pin
Richard MacCutchan14-Jan-24 21:42
mveRichard MacCutchan14-Jan-24 21:42 
QuestionPlease help me with this password validation - While Loop Running Once Pin
R1s1ng Phoen1x14-Jan-24 4:35
R1s1ng Phoen1x14-Jan-24 4:35 
AnswerRe: Please help me with this password validation - While Loop Running Once Pin
Richard MacCutchan14-Jan-24 5:15
mveRichard MacCutchan14-Jan-24 5:15 
GeneralRe: Please help me with this password validation - While Loop Running Once Pin
R1s1ng Phoen1x14-Jan-24 5:58
R1s1ng Phoen1x14-Jan-24 5:58 
GeneralRe: Please help me with this password validation - While Loop Running Once Pin
Richard MacCutchan14-Jan-24 6:06
mveRichard MacCutchan14-Jan-24 6:06 
AnswerRe: Please help me with this password validation - While Loop Running Once Pin
Gerry Schmitz14-Jan-24 5:19
mveGerry Schmitz14-Jan-24 5:19 
GeneralRe: Please help me with this password validation - While Loop Running Once Pin
R1s1ng Phoen1x14-Jan-24 5:59
R1s1ng Phoen1x14-Jan-24 5:59 
Questionviewing Java disassembly Pin
mike741111-Jan-24 22:55
mike741111-Jan-24 22:55 
AnswerRe: viewing Java disassembly Pin
Richard MacCutchan11-Jan-24 23:22
mveRichard MacCutchan11-Jan-24 23:22 
GeneralRe: viewing Java disassembly Pin
jschell12-Jan-24 10:13
jschell12-Jan-24 10:13 
GeneralRe: viewing Java disassembly Pin
Richard MacCutchan12-Jan-24 22:09
mveRichard MacCutchan12-Jan-24 22:09 
AnswerRe: viewing Java disassembly Pin
jschell12-Jan-24 10:14
jschell12-Jan-24 10:14 
GeneralRe: viewing Java disassembly Pin
mike741112-Jan-24 10:25
mike741112-Jan-24 10:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.