1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Scorpion4ik [409]
3 years ago
6

Java

Computers and Technology
1 answer:
ladessa [460]3 years ago
4 0

Answer:

public class Lab10

{

//Constants

private final static String NAME = "John Terry"; // replace YOUR NAME with your name

private final static int STUID = 123456789;

private final static double GPA1 = 4.00;

private final static double GPA2 = 2.34;

//main method

public static void main (String[] args)

{

Student stu1;

stu1 = new Student(NAME, STUID, GPA1);

System.out.println("\nName: " + stu1.getName());

System.out.println("Id Number: " + stu1.getIdNum());

System.out.println("GPA : " + stu1.getGPA());

stu1.setGPA(GPA2);

System.out.println(stu1 + "\n");

// Create a second student object

// With a name of Trine Thunder, a

// gpa of 4.00, and a student Id of

// 000000001

// You do not need to declare these at final constants,

// but you can if you want to.

System.out.println("\nName: Trine Thunder" );

System.out.println("Id Number: 000000001");

System.out.println("GPA : 4.00");

Student stu2 = new Student("Trine Thunder",000000001, 4.00 );

// [Add code here]

// Print out this student similar to above.

// You do not need to reset the gpa of this student.

System.out.println(stu2 + "\n");

// [Add code here]

// Check if both objects are same using == and .equals() methods.

// Print the message in both cases, whether same or not as shown in sample output.

System.out.println("Using ==");

if(stu1 == stu2){

System.out.println("Both are same");

}

else{

System.out.println("Both are different");

}

stu1.equals(stu2);

// [Add code here]

} // end of main

} // end of class Lab10

// Name:

// Section:

// Lab 10

// CS1113

// Fall 2016

// Class : Student.java

public class Student

{

//class variables

private String name;

private int idNum;

private double gpa;

// Constructor

public Student(String namePar, int idNumPar, double gpaPar)

{

// Save namePar to class variable name

name = namePar;

// [Add code here]

idNum = idNumPar;

// Save idNumPar to class variable idNum

gpa = gpaPar ;

// [Add code here]

// Save gpaPar to class variable gpa

// [Add code here]

}

// Accessor: returns name of student

public String getName()

{

// Return the name of the student

return name;

// [Add code here]

}

// Accessor: returns GPA of student

public double getGPA()

{

// Return the gpa of the student

return gpa;

// [Add code here]

}

// Accessor: returns idNum of student

public int getIdNum()

{

// Return the idnum of the Student

return idNum;

// [Add code here]

}

// Mutator: Changes the GPA of the student

public void setGPA(double g)

{

// Set the class variable gpa equal to g

gpa = g;

// [Add code here]

}

// toString method: Returns a formatted string

// of student information.

// As shown in sample output.

public String toString()

{

// declare a String variable to store the string value

// then return the formatted String.

String s ="";

s = s + "Student Name: "+name+"\n";

s =s + "Student Id num: "+idNum+"\n";

s =s + "Student GPA: "+gpa+"\n";

return s;

// [Add code here]

}

// implement .equals() method which returns a boolean value

// of student information. When you call this method,

// it should print message as shown in sample output.

public boolean equals(Student s)

{

//[Add code here]

System.out.println("Using .equals() method");

if(this.equals(s.idNum == this.idNum)){

System.out.println("Both are same");

return true;

}

else{

System.out.println("Both are different");

return false;

}

}

} // end of class Student

Explanation:

Output:

Name: John Terry

Id Number: 123456789

GPA : 4.0

Student Name: John Terry

Student Id num: 123456789

Student GPA: 2.34

Name: Trine Thunder

Id Number: 000000001

GPA : 4.00

Student Name: Trine Thunder

Student Id num: 1

Student GPA: 4.0

Using ==

Both are different

Using .equals() method

Both are different

You might be interested in
Arturo is a security professional. He is strengthening the security of an information system. His design ensures that if a field
Cloud [144]

Arturo is attempting to protect the database (data) of an information system (IS).

<h3>What is an information system?</h3>

An information system (IS) can be defined as a set of computer systems, that is typically used to collect, store, and process data, as well as the dissemination of information, knowledge, and the distribution of digital products.

In Cybersecurity, there are two (2) main techniques that can be used to check data when inputted in an information system (IS) and these include:

  • Verification
  • Validation

Data validation is a type of check which is primarily performed by a software program (application) to make sure that the data which is entered into an information system (IS) is allowable and sensible.

This ultimately implies that, any data that is not allowed or sensible are rejected and discarded by the computer system.

In conclusion, we can deduce that Arturo is attempting to protect the database (data) of an information system (IS).

Read more on data here: brainly.com/question/25885448

3 0
2 years ago
All of the following are ways to improve the mobile experience for a website visitor EXCEPT:
Jobisdone [24]

Answer:

Adding more links to the page.

Explanation:

User experience design, UED, is a concept or a process of software development application life cycle that graphically presents a clients project to reflect the needs, want and interactivity of the users.

There are certain principles that governs the design of user interactive web and mobile interfaces. A user interface has to be simple, easy to interact with, give a good feel, signing into email, phone, laptop, mobile app etc, should also be made easy.

Covering the screen with link, makes it difficult to navigate without triggering a link.

3 0
3 years ago
he transport layer on the destination host O reassembles the application message if it has been fragmented O removes the transpo
Dafna1 [17]

Answer: Both A and B

Explanation: Transport layer is the level of the OSI model which is helpful in maintaining the overall network communication.The application process that is being executed in the layers of architecture gets logical communication through transport layer.

It has the ability to connect the data that has been divided into section for the transportation.It can also act on the transport header ,which finds the transmission flow of specific data when not required.

4 0
3 years ago
Discuss your role as an IT professional in terms of your responsibility to clients, co-workers and society.
Tom [10]

An IT professional is expected to deliver correct installations and programming that are safe from security breaches to clients. To co-workers, teamwork, respect, and brainstorming are needed to work together and achieve results. To society, an IT professional is expected to deliver architectures that do not compromise security and privacy.

An information technology professional could be focused on the hardware or software of systems. It is vital that IT professionals deliver services that are foolproof and not susceptible to attacks.

When working with colleagues, they must cooperate in order to deliver the most efficient services.

Learn more about IT professionals here:

brainly.com/question/14314381

8 0
1 year ago
When you open a browser window it opens in a _____________.
postnew [5]
The answer is D window
7 0
3 years ago
Other questions:
  • Consider the two computers A and B with the clock cycle times 100 ps and 150 ps respectively for some program. The number of cyc
    5·2 answers
  • An outline is most like which of the following?
    7·1 answer
  • Producers must understand the marginal benefit of making an additional unit which shows the ...
    5·2 answers
  • After an informative session, you find yourself with several pages of notes. For maximum retention and understanding, you should
    6·1 answer
  • Name the function in Python that prompts user to enter values as per the data type specified.
    5·1 answer
  • You are a network engineer tasked with performing a site survey for a multiple-channel architecture (MCA) system in a three-stor
    11·1 answer
  • A system administrator is selecting an operating system for use by the company’s research and development team. The team require
    15·1 answer
  • Maeve has created the website, but she is not able to include more than one blank space at a time. Even if she hits the SPACE bu
    6·1 answer
  • The term generally used to describe storage systems that function at high speeds is:
    12·1 answer
  • Does trend in computing important for organization management?​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!