SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 02 Jan 2018 My Price 10.00

@param args the command line arguments

TestUnitScreenShot (5).PNGHello. I want help in the tests to be passed. Although i have the files they are not passing. I will share the screenshot as well that i found suspicious.



  • import java.time.LocalDate;
    import java.time.Month;


    public class StudentTestMain {

        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
           Student student1 = new Student("Adam","Baum","1234567890",
                                                    LocalDate.of(2001, Month.MARCH, 10), "Male","20-Havelock Street");
          
           System.out.printf("The first student is %s%n", student1.toString());
          
          
          
           Student student2 = new Student("Marie","Curie","1234567858",
                   LocalDate.of(2002, Month.MARCH, 10), "Female","20-Birhana Street");
          
            System.out.printf("The second student is %s%n", student2.toString());
          
        }
       
    import java.time.LocalDate;
    import java.time.Period;


    public class Student {
        private String firstName, lastName, gender,address;
        private String mobileNumber;
        private LocalDate birthdate;
       
        public Student(String first, String last, String mobileNumber, LocalDate dob, String gender, String address)
        {
            firstName = first;
            lastName = last;
            this. mobileNumber = mobileNumber;
            this.gender = gender;
            if(address.length()==0){
                throw new IllegalArgumentException("Address can't be blank");
            }
            this.address = address;
            setBirthday(dob);
        }
       
        /**
         * This method will validate that the Student is 5-20 years old
         */
        public void setBirthday(LocalDate dob)
        {
            try{
            LocalDate today = LocalDate.now();
            int age = Period.between(dob, today).getYears();
           
            if (age >= 5 && age <= 20)
                birthdate = dob;
            else
                throw new IllegalArgumentException("Employees must be 5-20 years old");
            }catch(Exception e){
                throw new IllegalArgumentException("Employees must be 5-20 years old");
            }
        }

        public String getFirstName() {
            return firstName;
        }

        public String getLastName() {
            return lastName;
        }

        public String getMobileNumber() {
            return mobileNumber;
        }

        public LocalDate getBirthdate() {
            return birthdate;
        }
       
        /**
         * This method will return the Student's first and last name
         */
        @Override
        public String toString()
        {
            String text ="Name: "+firstName + " " + lastName+"\nMobile Number: "+mobileNumber+"\nDate of Birth: "+birthdate+"\nAddress: "+address+"\n";
            return text;
        }
       
       
       
    }
    }

Attachments:

Answers

(5)
Status NEW Posted 02 Jan 2018 12:01 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)