Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
O

Olivia8

@Olivia8
About
Posts
3
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • My java output is running but the output does not follow assignment format
    O Olivia8

    How can my output have the same structure/output as the sample 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 :

    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 :

    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 ");
    	}
    	
    }
    

    }

    Java java help career

  • Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1"
    O Olivia8

    Hey! Thanks for the reply I ended up using the debugger and made some changes with the data index and my code runs! Appreciate it!

    Java help java database career learning

  • Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1"
    O Olivia8

    I have an assignment where the main class output mentions Index 1 out of bounds for length 1 and im trying to read a csv file which has 4 rows and 4 columns below is my code and csv file. Please help the assignment is due tonight at midnight Eastern time :/ I am in my first year of computer science and the assignment is for my introduction of Object-oriented programing, I still consider myself beginner. main class:

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

    	try {
    		
    		List<String\[\]> data = CSVReader.readTechnicians(relativePath);
    		
    		if(data != null) {
    	
    	
    	for(String\[\]technician : data) {
    		String position = technician\[0\];
    		String name = technician\[1\];
    		String technicianId = technician\[2\];
    		double salaryOrHourlyRate = Double.parseDouble(technician\[3\]);
    		
    		BaseTechnician emp;
    		switch(position) {
    		case " Fulltime ":
    		 emp = new FullTimeTechnician(name, technicianId,salaryOrHourlyRate);
    		break;
    		case " PartTime ":
    		 emp = new PartTimeTechnician(name, technicianId, salaryOrHourlyRate);
    			break;
    			default:
    				System.out.println(" Wrong technician position ");
    				continue;
    		}
    		technicians.add(emp);
    		
    		for(BaseTechnician tech : technicians ) {
    			tech.displayDetails();
    			System.out.println(" Calculated Salary : " + tech.calculateSalary());
    			System.out.println();
    		}
    		
    	}
    	} else {
    		System.out.println("Error Failed to read data from the technician CSV file ");
    	}
    	
    } catch (Exception e) {
    	System.out.println(" Error occured " + e.getMessage() );
    }
    	
    }
    

    }

    and csv file:

    FullTime David Jonathan FT1001 50000
    PartTime Keith Peters PTE 2001.00 24.5
    FullTime Mary Aramal FTE1003 60000
    PartTime Hassan Otosh PTE 2002.00 30.5
    FullTime Bernard Becker FTE1004 40000
    PartTime Roselyn Anne PTE 2003.00 24.5
    FullTime James Lead FTE1005 80000

    Java help java database career learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups