Questions
Can someone find what's wrong? If I don't use the last main method Netbeans says that...

Can someone find what's wrong? If I don't use the last main method Netbeans says that there is no main method. I can't figure out what's wrong.

This was the prompt:

Design a class named triangle that extends geometricObject. For this, you should have created a GeometricObject class first. The class contains:

  • Three double datafields named side1, side2, side3 with default value 1.0.
  • A no arg constructor that creates a default triangle.
  • A constructor that creates a triangle with specified side1, side2 and side3.
  • A method named getPerimeter() that returns the perimeter of a triangle.
  • A method name toString that returns the string description of a triangle.(including color and filled)

Your main method should create a triangle object and display it using toString()

This is my code:

package geometricobject;

/**
*
*
*/
public class GeometricObject {

/**
* @param args the command line arguments
*/
private String color = "white";
private boolean filled;
private java.util.Date dateCreated;

public GeometricObject() {
dateCreated = new java.util.Date();
}

public GeometricObject(String color, boolean filled) {
dateCreated = new java.util.Date();
this.color = color;
this.filled = filled;
}

public String getColor() {
return color;
}

public void setColor(String color) {
this.color = color;
}

public boolean isFilled() {
return filled;
}

public void setFilled(boolean filled) {
this.filled = filled;
}

public java.util.Date getDatecreated() {
return dateCreated;
}
  
public String toString() {
return "created on" + dateCreated + "\ncolor: " + color+ " and filled: " + filled;
}
  


public class triangle extends GeometricObject
{
private double side1;
private double side2;
private double side3;
  
public triangle() {
side1 = 1;
side2 = 1;
side3 = 1;
}
  
public triangle(double side1, double side2, double side3) {
this.side1 = side1;
this.side2 = side2;
this.side3 = side3;
}
public double getSide1() {
return side1;
}
public double getSide2() {
return side2;
}
public double getSide3() {
return side3;
}
public void setSide1(double side1) {
this.side1 = side1;
}
public void setSide2(double side2) {
this.side2 = side2;
}
public void setSide3(double side3) {
this.side3 = side3;
}
public double getArea() {
double n = (side1+side2+side3) / 2.0;
return Math.sqrt(n*(n-side1)*(n-side2)*(n-side3));
}
public double getPerimeter() {
return side1 + side2 + side3;
}
  
@Override
public String toString() {
return super.toString() + "Triangle: side1 = " + side1 + " side2 = " + side2 + "side3 = " + side3 ;

}}}

In: Computer Science

USING C++ Create a program that defines a struct for a student. The following data should...

USING C++

Create a program that defines a struct for a student. The following data should be part of the struct: studentID (int), gpa(double), fullName(string), units(int).

Instantiate two students and have the user type in information for each, then print both back to the screen afterwards. Input validation: studentID should be positive and have 4 digits, GPA should be between 0 and 4 (inclusive), units should be positive. Have any invalid inputs reentered.

In: Computer Science

Tree Traversals It should be noted that, in class, all traversal methods were written as recursive...

Tree Traversals It should be noted that, in class, all traversal methods were written as recursive algorithm (i.e. at some point, the method called itself). It is possible to implement non-recursive versions of preorder, inorder, and postorder traversal methods mentioned in class. One intuitive way is by using a stack.
1) Give written pseudocode/explanation of :
a) How to build the tree such that a given non-recursive traversal method can be used.
b) Your algorithm for a non-recursive preorder, inorder, OR postorder traversal method (You only have to pick one)
2) Implement the above mentioned algorithms. Traversals should print out nodes in their required order.

In: Computer Science

what is meant by the term data consolidation

what is meant by the term data consolidation

In: Computer Science

a): Suppose we have developed the following rules and facts for our system. Rule 1: If...

a): Suppose we have developed the following rules and facts for our system.
Rule 1: If X is an animal then X is living spices
Rule 2: If X is living spices then X is a life form
Rule 3: If X is a life form then X is mortal
Fact: Dog is an animal.
Goal: Is Dog a mortal?

Problem: Using forward chaining, try to conclude that Dog is mortal.

b)The following is the rule set of a simple weather forecast expert system:

Rule 1. IF cyclone THEN clouds
Rule 2. IF anticyclone THEN clear sky
Rule 3. IF pressure is low THEN cyclone
Rule 4. IF pressure is high THEN anticyclone
Rule 5. IF arrow is down THEN pressure is low
Rule 6. IF arrow is up THEN pressure is high

Problem: Use backward chaining to reason about the weather if the working
memory contains the fact: clouds. Show your answer in a table naming the
rules matching the current working memory (conflict set), which rule you
apply, and how the working memory contents changes on the next step after a
rule has fired:

hnt: artificial intelligence question

In: Computer Science

Design a class named Employee. The class should keep the following information in fields: • Employee...

Design a class named Employee. The class should keep the following information in fields: • Employee name • Employee number in the format XXX–L, where each X is a digit within the range 0–9, and the L is a letter within the range A–M. • Hire date Write one or more constructors and the appropriate accessor and mutator methods for the class. Next, write a class named ProductionWorker that inherits from the Employee class. The ProductionWorker class should have fields to hold the following information: Shift (an integer) Hourly pay rate (a double) The workday is divided into two shifts: day and night. The shift field will be an integer value representing the shift that the employee works. The day shift is shift 1, and the night shift is shift 2. Write one or more constructors and the appropriate accessor and mutator methods for the class. Demonstrate the classes by writing a program that uses a ProductionWorker object. In a particular factory, a shift supervisor is a salaried employee who supervises a shift. In addition to a salary, the shift supervisor earns a yearly bonus when his or her shift meets production goals. Design a ShiftSupervisor class that inherits from the Employee class. The ShiftSupervisor class should have a field that holds the annual salary, and a field that holds the annual production bonus that a shift supervisor has earned. Write one or more constructors and the appropriate accessor and mutator methods for the class. In a particular factory, a team leader is an hourly paid production worker who leads a small team. In addition to hourly pay, team leaders earn a fixed monthly bonus. Team leaders are required to attend a minimum number of hours of training per year. Design a TeamLeader class that inherits from the ProductionWorker class. The TeamLeader class should have fields for the monthly bonus amount, the required number of training hours, and the number of training hours that the team leader has attended. Write one or more constructors and the appropriate accessor and mutator methods for the class. Demonstrate the classes by writing a program that uses a TeamLeader object and a ShiftSupervisor object, as well as an Employee object. Be sure that all methods defined are called.

In: Computer Science

What is your educational goal as a spaceship engineer 600 words

What is your educational goal as a spaceship engineer 600 words

In: Computer Science

Discuss a specific situation where association rules are used, or could be used, in your organization...

Discuss a specific situation where association rules are used, or could be used, in your organization or in one with which you are familiar. Which association rules are relevant to the organization and why?

In: Computer Science

1.Create a standard Java project (i.e. not a JavaFX project) in NetBeans called Personsages 2.Declare a...

1.Create a standard Java project (i.e. not a JavaFX project) in NetBeans called Personsages

2.Declare a Scanner variable called keyboardInput and a variable called personAge as type int. Code the statement to read in an integer with a prompt to "Enter your age as an integer:".

3.Code an "if/else if" (also called a multi-way if) block to output the following text based on age ranges personAge might contain:

  • 0 through 12: Person is a pre-teen.
  • 13 through 19: Person is a Teenager.
  • 20 through 29: Person is in their 20's.
  • 30 through 39: Person is in their 30's.
  • 40 or greater: Person is 40 years or older.

4.Code an "if / else" statement to determine if the age entered in Step 9 is on/before the year 1990 or after 1990 outputting the message that the person was born on/before or after 1990.

5.Declare a String variable called aCityInNY and read in a String from the keyboard with a prompt "Enter Albany, Buffalo, New York, Rochester, or Binghampton to see its population:".

6.Code a switch block to compare the value input to the cities just mentioned. Output "Population is: " with the population of each city (you are not being tested on the actual population). If the user enters any other city or text, output an appropriate error message to the user.

7.Declare an integer variable called intInput and assign it a 0. Declare a Boolean called keepLooping and set to true. Code a while loop with keepLooping as the condition.

8.In the body of the while loop, code a prompt that says “Input a number – enter 999 to exit:”. Use a Scanner method to get an integer from the keyboard and assign it to intInput. Output the number only if it does not equal 999, else set keepLooping false.

9.Declare a variable called loopInt. Code a for loop that uses loopInt and counts from 0 to 9.

10.In the for loop body, output “For Loop Counter = “ + loopInt.

11.After the for loop, set the loopInt variable to 0. Code a do-while loop that ends after loopInt is 9.

12.In the body of the do-while, output “Do-While Loop Counter = “ + loopInt. Code a statement to increase loopInt by 1.

13.After the while loop, declare an int variable called loopIntInner and an int variable called loopIntOuter. Code a for loop that counts loopIntOuter from 0 to 4. This is the outer loop. In the body, code another for loop (this is the inner loop) that counts loopIntInner from 0 to 2. In the body of the inner loop put an output statement that outputs “loopIntOuter: “ + loopIntOuter + “ loopIntInner: “ + loopIntInner.

14.Run the program with 32 as the age prompt in Step 9.

15.Enter at least one valid city for Step 12.

16.Enter at least 2 numbers for 15 and then 999.

In: Computer Science

Please use python. Step a: Create two DataFrames df1 and df2 from the following two tables...

Please use python.
Step a: Create two DataFrames df1 and df2 from the following two tables that hold student scores. Each DataFrame has four rows and three columns.

df1:

df2:

Name

Course A

Course B

Name

Course C

Course D

Adam

80

84

Bob

65

72

Bob

74

76

David

85

82

David

78

83

Eva

76

80

Tom

85

82

Tom

90

88

Step b: Join the two DataFrames into df3 so that it only includes the students who appear in both tables. Print df3.

Step c: Set the column 'Name' as the index of df3 using df3.set_index() function. Print the updated df3. You can learn from https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.set_index.html.

Step d: Show the average score of each student in df3.

In: Computer Science

A PC store sells many types of computers. The PC can have either 16 or 8...

A PC store sells many types of computers. The PC can have either 16 or 8 gigabytes of memory.

The quality of the PCs can be either New, Refurbished, or Dented.

The price list is given as follows:

Memory size/Status New Refurbished Dented

16 gigabytes 849.99 729.99 609.99

8 gigabytes 699.99 579.99 439.99


Determine the price of a given PC dependent on the user inputs. The sale tax is 9.25% for each PC.

User input can only be 8 or 16 for memory size and 'N', 'R', or 'D' for quality (upper-case). The input quantityt should be 0 or positive.

If any user input is not correct, display an error message and skip all calculation.

All currency amount should be displayed with 2 digits in decimal fraction.


Here are several separate program sample runs. There is No need to use loop for repetition.

Enter the memory size of the PC (8 or 16 gigabytes): 16

Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): N

Enter PC quantity want to buy: 2

The item price is $1699.98

The sale tax is $157.25

The total bill is $1,857.23

----------------------

Enter the memory size of the PC (8 or 16 gigabytes): 8

Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): R

Enter PC quantity want to buy: 3

The item price is $1739.97

The sale tax is $160.95

The total bill is $1900.92

----------------------

Enter the memory size of the PC (8 or 16 gigabytes): 15

Invalid memory size!

----------------------

Enter the memory size of the PC (8 or 16 gigabytes): 8

Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): A

Invalid PC quality!

----------------------

Enter the memory size of the PC (8 or 16 gigabytes): 8

Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): (user hit Tab key)

Invalid PC quality!


----------------------

Enter the memory size of the PC (8 or 16 gigabytes): 16

Enter the quality of the PC (N for New, R for Refurbished, or D for Dented): R

Enter PC quantity want to buy: -2

Invalid PC quantity!

[C++ PROGRAMING]

In: Computer Science

Simulate a D-Flip Flop on Xilinx using Verilog HDL | Behavioral Modelling PS: please include the...

Simulate a D-Flip Flop on Xilinx using Verilog HDL | Behavioral Modelling

PS: please include the simulation screenshot and output and the code

In: Computer Science

Write a program that asks the user to enter a sentence and then switch all lower...

Write a program that asks the user to enter a sentence and then switch all lower case letters to capitals and all upper case letters to lower. HINT: use the ASC function to tell your program which letters are upper or lower case so you can switch them. Your program should allow for multiple test cases.


In: Computer Science

Write a program using MARIE’s assembly language. The program consists of a main program and a...

Write a program using MARIE’s assembly language. The program consists of a main program and a subroutine. It uses the subroutine to process a given number. If the value of the number is negative, the value will be replaced with zero and returned. Otherwise, the value is doubled and returned. Then, in the main program, it calls the subroutine to process for X = -3 and saves the value after the processing.

In: Computer Science

Write a fragment of code that uses two existing arrays of doubles, a and b, creates...

Write a fragment of code that uses two existing arrays of doubles, a and b, creates a third array c, and assigns each element of c to the average of the corresponding elements of a and b. You may assume that the arrays a and b are the same length. (java)

In: Computer Science