A point on the two-dimensional plane can be represented by two numbers: a X coordinate and a Y coordinate. For example, (4,5) represents a point 4 units to the right of the origin along the X axis and 5 units up the Y axis. The sum of two points can be defined as a new point whose X coordinate is the sum of the X coordinates of the points and whose Y coordinate is the sum of their Y coordinates.
Write a program that uses class point to model a point. Define data members X and Y coordinates. Create objects for point class, get data from user for two points, pass it using constructors. Use data member function SumPoint(obj1, obj2) to find the sum and return it. Use another member function Display() to display the new coordinates.
A point on the two-dimensional plane can be represented by two numbers: a X coordinate and a Y coordinate.
reate a simple text-based console game that implements at least three (3) interfaces
Create method:
Method name: maxIndex
Method parameters: An integer array named arr
Method return: An integer value
Method description: This method will find the index of the array arr with the maximum value.
For example, if arr ={1.0, 2.0, 5.5, 1.5}, then it returns 2 since the maximum is 5.5 and it is present in index 2. In case, there are two same values, it returns the index of the last same value.
Java
Can u pls explain to me the details of this program? how did it come up to this, the uses of each part
import java.util.Scanner;
public class Activity3 {
public static void main(String[] args) {
System.out.println(two(5,3));
}
public static int one(int x, int y) {
return x > y ? x + y : x - y * 2;
}
public static double two(int x, double a) {
Scanner in = new Scanner(System.in);
int first = one(6, 8);
double z = in.nextDouble();
z += a;
first += x;
return z > first * 2 ? z : 2 * first - z;
}
}
We want to calculate the total marks of each student of a class in Physics, Chemistry and Mathematics and the average marks of the class. The number of students in the class are entered by the user. Create a class named Marks with data members for roll number, name and marks. Create three other classes inheriting the Marks class, namely Physics, Chemistry and Mathematics, which are used to define marks in individual subject of each student. Roll number of each student will be generated automatically.
You are a system administrator with broad access to enterprise systems. Your supervisor has asked you to begin archiving all of the emails and web activity logs of one of your co-workers.Typically requests of this nature are initiated through a formal communication from your campus’s legal office. You feel that this request is inappropriate and possibly at odds with standard campus procedure and processes.You raise your concerns with your supervisor, but are told that this is a sensitive matter, and details cannot be shared with you. After thinking more about the conversation, you had with your supervisor, you are under the impression that you might lose your job if you persist in discussing the matter further or if you refuse to carry out the task. What would you do? In your answer, refer to ethical codes and what IT
professionals need to commit to and mention a few general or common principles included in ethical codes.
You probably have encountered Triangle pattern problems before when you started learning programming. Let’s see how well you do with numbers this time. Try to look at the examples closely and think of an algorithm that replicates the outputs. Go for it!
Input
A single line containing an integer n.
9
Output
The output generated based on the inputted integer n.
1
23
456
789
Or
Input
4
Output
1
23
4
Or input
12
Output
1
23
456
78910
1112
Using WHILE LOOP statement
Write a Program that will ask the user to accept an
integer input and outputs message below:
Print Numbers Descending (from 1000)
Enter the number that you want to print:
Number of iterations:
The taxi has a base fee of P40.00 for the first 250 meters. An additional P2.50 is added for every succeeding 200 meters. Compute and print the total fare that you would need to pay