Create a new program called Time.java. From now on, we won’t remind you to start with a small, working program, but you should. 2. Following the example program in Section 2.4, create variables named hour, minute, and second. Assign values that are roughly the current time. Use a 24-hour clock so that at 2pm the value of hour is 14. 3. Make the program calculate and display the number of seconds since midnight. 4. Calculate and display the number of seconds remaining in the day. 5. Calculate and display the percentage of the day that has passed. You might run into problems when computing percentages with integers, so consider using floating-point. 6. Change the values of hour, minute, and second to reflect the current time. Then write code to compute the elapsed time since you started

Answers

Answer 1

Answer:

Explanation:

public class time {

public static void main (String[]args) {

 //Step 1  we declare the variables

 int hours, minutes, seconds;

 hours = 17;

 minutes = 12;

 seconds = 00;

 //For checking

 System.out.println(hours+":"+minutes+":"+seconds);

 //Step 2 we make the operation for the seconds since midnight

 int secSinceMidNite;

 secSinceMidNite = ((hours*60)+minutes)*60 + seconds;

 System.out.println("Seconds since midnight = "+secSinceMidNite);

 //Step 3 we make the operation for the seconds remaining in day

 int secRemainingInDay, totalSecInDay;

 totalSecInDay = 24*60*60;

 secRemainingInDay = totalSecInDay - secSinceMidNite;

 System.out.println("Seconds remaining in day = "+secRemainingInDay);

 //Step 4 in the operation for percentage of day that has passed

 int percentOfDayPassed;  

 percentOfDayPassed = (secSinceMidNite*100)/totalSecInDay;

 System.out.println("Percentage of day that has passed = " +percentOfDayPassed+"%");

}

}


Related Questions

Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type double. If the method is called with 50 20.0 3.1599, the method returns 7.89975.

Answers

Answer:

public static double drivingCost(int drivenMiles, double milesPerGallon,double dollarsPerGallon){

       return (drivenMiles/milesPerGallon)*(dollarsPerGallon);

   }

Find a complete java program that prompts the user to enter this values and the calls this Method in the explanation section.

Explanation:

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

   Scanner in = new Scanner(System.in);

       System.out.println("Please Enter the Driven Miles");

       int drivenMiles = in.nextInt();

       System.out.println("Please Enter the Your fuel consumption in miles/gallon");

       double milesPerGallon = in.nextDouble();

       System.out.println("Please Enter the cost of fuel in Dollars/gallon");

       double dollarsPerGallon = in.nextDouble();

       double dollarCost = drivingCost(drivenMiles,milesPerGallon,dollarsPerGallon);

       System.out.println("The Total Cost in Dollars is "+dollarCost);

       }

   public static double drivingCost(int drivenMiles, double milesPerGallon,double dollarsPerGallon){

       return (drivenMiles/milesPerGallon)*(dollarsPerGallon);

   }

}

2.Consider the following algorithm and A is a 2-D array of size ???? × ????: int any_equal(int n, int A[][]) { int i, j, k, m; for(i = 0; i < n; i++) for( j = 0; j < n; j++) for(k = 0; k < n; k++) for(m = 0; m < n; m++) if(A[i][j]==A[k][m] && !(i==k && j==m)) return 1 ; return 0 ; } a. What is the best-case time complexity of the algorithm (assuming n > 1)? b. What is the worst-case time complexity of the algorithm?

Answers

Answer:

(a) What is the best case time complexity of the algorithm (assuming n > 1)?

Answer: O(1)

(b) What is the worst case time complexity of the algorithm?

Answer: O(n^4)

Explanation:

(a) In the best case, the if condition will be true, the program will only run once and return so complexity of the algorithm is O(1) .

(b) In the worst case, the program will run n^4 times so complexity of the algorithm is O(n^4).

What might an administrator use to try to catch an insider attempting to access confidential information on the company servers?

Answers

Answer:

There are four options for these questions: and d is correct answer

a. signature

b. priority file

c. moles

d. honeytoken

Explanation:

Honeytokens are words or fictitious records implemented in a database, with this option we can track data in a complex situation, for example, in cloud computing, if someone tries to steal data from the database we can detect, who was the thief, and we can add a honeytoken in every record of our database.

IN PYTHON

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value.

Answers

Answer:

Python program is given below

Explanation:

def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):

   print("The integers that are less than or equal to", upper_threshold, "are:")

   for value in user_values:

       if value < upper_threshold:

           print(value)

def get_user_values():

   n = int(input("Enter the number of integers in your list: "))

   lst = []

   print("Enter the", n, "integers:")

   for i in range(n):

       lst.append(int(input()))

   return lst

if __name__ == '__main__':

   userValues = get_user_values()

   upperThreshold = int(input("Enter the threshold value: "))

   output_ints_less_than_or_equal_to_threshold(userValues, upperThreshold)

The question is about writing a Python program that filters a list of integers, outputting only those less than or equal to the last integer in the list, based on user input.

Python Program to Filter Integers

To write a Python program that filters integers from a list based on a specific condition, you'll first need to capture user input. Since the user will indicate the number of integers followed by the integers themselves, you can use a loop to collect these values. Afterward, you can compare each integer to the last value obtained from the input and output all integers less than or equal to this last value.

Here's an example code:

num_of_integers = int(input())
integers_list = []

for _ in range(num_of_integers):
   integers_list.append(int(input()))

threshold = integers_list[-1]

for value in integers_list[:-1]:
   if value <= threshold:
       print(value)

This program stores all integers in a list, then iterates over the list except the last element and prints out those integers that are less than or equal to the last value in the list.

Design and implement a class dayType that implements the day of the week in a program. The class dayType should store the day, such as Sun for Sunday.
The program should be able to perform the following operations on an object of type dayType:

a) set the day
b) print the day
c) return the day
d) return the next day
e) return the previous day
f) calculate and return the day by adding certain days to the current day. for example, if the current day is Monday and we add 4 days, the day to be returned is Friday. similarly, if today is Tuesday and we add 13 days, the day to be returned is Monday.
g) add the appropriate constructors.

Write the definitions of the functions to implement the operations for the class dayType. Also write a program to test various operations on this class.

Answers

The code is implemented based on the given operations.

Explanation:

#include <iostream>

#include <string>

using namespace std;

class dayType

{ private:

 string day[7];

 string presentDay;

 int numofDays;

public:

 void setDay(string freshDay);

 void printDay() const;

 int showDay(int &day);

 int nextDay(int day);

 int prevDay(int day) const;

 int calcDay(int day, int numofDays);    

 dayType()

 {

  day[0] = "Sunday";

  day[1] = "Monday";

  day[2] = "Tuesday";

  day[3] = "Wednesday";

  day[4] = "Thursday";

  day[5] = "Friday";

  day[6] = "Saturday";

  presentDay = day[0];

  numofDays = 0;

 };

 ~dayType();

};

#endif

#include "dayType.h"

void dayType::setDay(string freshDay)

{

  presentDay = freshDay;

}

void dayType::printDay()

{

  cout << "Day chosen is " << presentDay << endl;

}

int dayType::showDay(int& day)

{

  return day;

}

int dayType::nextDay(int day)

{

day = day++;

if (day > 6)

 day = day % 7;

switch (day)

{

case 0: cout << "The successive day is Sunday";

 break;

case 1: cout << "The successive day is Monday";

 break;

case 2: cout << "The successive day is Tuesday";

 break;

case 3: cout << "The successive day is Wednesday";

 break;

case 4: cout << "The successive day is Thursday";

 break;

case 5: cout << "The successive day is Friday";

 break;

case 6: cout << "The successive day is Saturday";

 break;

}

cout << endl;

return day;

}

 

int dayType::prevDay(int day)

{

day = day--;

switch (day)

{

case -1: cout << "The before day is Saturday.";

 break;

case 0: cout << "The before day is Saturday.";

 break;

case 1: cout << "The before day is Saturday.";

 break;

case 2: cout << "The before day is Saturday.";

 break;

case 3: cout << "The before day is Saturday.";

 break;

case 4: cout << "The before day is Saturday.";

 break;

case 5: cout << "The before day is Saturday.";

 break;

default: cout << "The before day is Saturday.";

}

cout << endl;

return day;

}

int dayType::calcDay(int addDays, int numofDays)

{

addDay = addDays + numofDays;

if (addDay > 6)

 addDay = addDay % 7;

switch(addDay)

{

case 0: cout << "The processed day is Sunday.";

 break;

case 1: cout << "The processedday is Monday.";

 break;

case 2: cout << "The processedday is Tuesday.";

 break;

case 3: cout << "The processedday is Wednesday.";

 break;

case 4: cout << "The processedday is Thursday.";

 break;

case 5: cout << "The processedday is Friday.";

 break;

case 6: cout << "The processedday is Saturday.";

 break;

default: cout << "Not valid choice.";

}

cout << endl;

return addDays;

}

Final answer:

To design and implement the dayType class, define the instance variable 'day' to store the day of the week. Create methods to set the day, print the day, return the day, return the next day, return the previous day, and calculate the day by adding certain days. Test the class by creating an object and calling the methods.

Explanation:

To design and implement the dayType class, we can start by defining the instance variable 'day' to store the day of the week. We can then create a setDay method to set the value of 'day', and a printDay method to print the current day. The returnDay method can be used to return the current day, and the nextDay and previousDay methods can be implemented to calculate and return the next and previous days based on the current day. To calculate the day after adding a certain number of days, we can create a calculateDay method that adds the given number of days to the current day and returns the resulting day. Lastly, appropriate constructors can be added to initialize the object with a specific day.

Here is an example implementation of the dayType class in Python:

class dayType:
   def __init__(self, day):
       self.day = day
   
   def setDay(self, day):
       self.day = day
   
   def printDay(self):
       print(self.day)
   
   def returnDay(self):
       return self.day
   
   def nextDay(self):
       days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
       index = days.index(self.day)
       return days[(index + 1) % 7]
   
   def previousDay(self):
       days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
       index = days.index(self.day)
       return days[(index - 1) % 7]
   
   def calculateDay(self, num_days):
       days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
       index = days.index(self.day)
       return days[(index + num_days) % 7]

To test the class, you can create an object of the dayType class with a specific day, and call the different methods to perform the required operations.

Learn more about Implementing a dayType class here:

https://brainly.com/question/34680737

#SPJ3

Gwen recently purchased a new video card, and after she installed it, she realized she did not have the correct connections and was not able to power the video card.

What connector(s) should Gwen look for when purchasing a new power supply? (Select all that apply.)

a.8-pin PCI-E connector

b.Molex connector

c.24 pin connector

d.SATA connector

e.P4 MB connector

f.6-pin PCI-E connector

Answers

Answer:

A. 8-pin PCI-E connector.

F. 6-pin PCI-E connector.

Explanation:

The video card is a peripheral hardware component in a computer system that is used to run videos and graphic files, providing the required memory, runtime and bandwidth.

The PCI-e or peripheral component interconnect express is a connector or expansion slot used specifically for adding and powering video cards on a computer system.

Using 8-bit bytes, show how to represent 56,789. Clearly state the byte values using hexadecimal, and the number of bytes required for each context. Simply indicate the case if the code is not able to represent the information.

Answers

Answer:

a) 56789₁₀ = 11011110111010101₂ (unsigned integer)

b) 56789₁₀ = 0000000011011110111010101₂ (Two's complement)

c) 56789₁₀ = 01010110011110001001 (BCD)

d) 56789₁₀ = ÝÕ (ASCII)

e) 56789₁₀ = 0 - 1000 1110 - 101 1101 1101 0101 0000 0000 (IEEE single precision)

Explanation:

a) 56789₁₀ = (1 × 2¹⁵) + (1 × 2¹⁴) + (0 × 2¹³) + (1 × 2¹²) + (1 × 2¹¹) + (1 × 2¹⁰) + (0 × 2⁹) + (1 × 2⁸) + (1 × 2⁷) + (1 × 2⁶) + (0 × 2⁵) + (1 × 2⁴) + (0 × 2³) + (1 × 2²) + (0 × 2¹) + (1 × 2⁰) = 11011110111010101₂

This requires 2 bytes - 16 bits and hexadecimal byte value of DDD5.

2) since the number is positive, the two's complement is just that same binary number with a signed 0 to indicate positive number in front.

56789₁₀ = 0000000011011110111010101₂

This requires 3 bytes - 24 bits and hexadecimal byte value of 11DDD5.

c) BCD

This converts each single bit in the base-10 to binary.

5 = 0101, 6 = 0110, 7 = 0111, 8 = 1000, 9 = 10001, then combined, we have

56789₁₀ = 01010110011110001001 (BCD)

It's an historic code.

This requires 3 bytes - 24 bits and hexadecimal byte value of 56789.

d) ASCII

This uses symbols to represent the numbers.

56789₁₀ = ÝÕ (ASCII)

This requires 1 byte - 8 bits.

e) IEEE single precision

Step 1, convert to base 2

56789₁₀ = 11011110111010101₂

Step 2, normalize the binary,

11011110111010101₂ =11011110111010101 × 2⁰ = 1.1011110111010101 × 2¹⁵

Sign = 0 (a positive number)

Exponent (unadjusted) = 15

Mantissa (not normalized) = 1.1011110111010101

Step 3, Adjust the exponent in 8 bit excess/bias notation and then convert it from decimal (base 10) to 8 bit binary

Exponent (adjusted) = Exponent (unadjusted) + 2⁽⁸⁻¹⁾ - 1 = 15 + 2⁽⁸⁻¹⁾ - 1 = (15 + 127)₁₀ = 142₁₀

Exponent (adjusted) = 142₁₀ = 1000 1110₂

Step 4, Normalize mantissa, remove the leading (the leftmost) bit, since it's allways 1 (and the decimal point, if the case) then adjust its length to 23 bits, by adding the necessary number of zeros to the right:

Mantissa (normalized) = 1.101 1101 1101 0101 0000 0000 = 101 1101 1101 0101 0000 0000

Therefore,

56789₁₀ = 0 - 1000 1110 - 101 1101 1101 0101 0000 0000

This requires 4 bytes - 32 bits and hexadecimal byte value of 8E5DD500.

Hope this helps!

/** What is a method that Determines whether this Date is before the Date d.
* @return true if and only if this Date is before d.
*/
public boolean isBefore(Date d) {
if(this.date.isBefore(d))
{
// replace this line with your solution
}

/** Determines whether this Date is after the Date d.
* @return true if and only if this Date is after d.

public boolean isAfter (Date d)

{
}
*/
public boolean isAfter(Date d) {
// replace this line with your solution
}

/** What is a method that Returns the number of this Date in the year.
* @return a number n in the range 1...366, inclusive, such that this Date
* is the nth day of its year. (366 is used only for December 31 in a leap year)

public int difference (date d)
* year.)
*/
public int dayInYear() {

return 0;


}

/** Determines the difference in days between d and this Date. For example,
* if this Date is 12/15/2012 and d is 12/14/2012, the difference is 1.
* If this Date occurs before d, the result is negative.
* @return the difference in days between d and this date.
*/
public int difference(Date d) {
return 0; // replace this line with your solution
}

Answers

Answer:

Following is given the solution to the question. This question has two parts of source code:

Date classMain class

The images are attached displaying code or each class.  Indentations are made clear so that the code get easier to understand.

Comments are given inside the code where necessary to make the logic clear.

Output for the code is also attached in the last image.

Explanation:

I hope it will help you!

ap csp The local, remote, and upstream _______ can each have multiple ___ _____. When a participant in a collaborative group on GitHub is ready to have their work used by the group, the participant makes a _______.

Answers

Answer:

The Local, Remote and Upstream repository can each have multiple push /pull requests. When  a Participant in a collaborative group on Github is ready to have their work used by the group,  the participants makes a pull request.

Explanation:

These are simple blanks which are answer here

The Local, Remote and Upstream repository can each have multiple push /pull requests. When  a Participant in a collaborative group on Github is ready to have their work used by the group,  the participants makes a pull request.

Patrick Rowe is a manager at a software firm. Jack Blair, Patrick's team member, is facing technical issues with software system. While communicating with Blair, Rowe used an impersonal statement to talk about the issue. Which of the following did Patrick say? A. "Why did you not tell me you did not know how to resolve such problems?" B. "This new software system has been giving us problems for a while now." C. "You will attend a training seminar on the new software system next week." D. "You should really know how to operate this new phone system by now." E. "Sam Todd has worked on this system before and will be able resolve the problem."

Answers

Answer:

B. "This new software system has been giving us problems for a while now."

Explanation:

Of all the given, answer B is the only impersonal statement. Passive voice is used and it is highly effective in remaining professional while communicating from a managerial role. By using an impersonal statement, the employee (Jack Blair) won't get offended by any means. Although he isn't personally mentioned in the answer E, he may feel guilt because there is someone else that is able to resolve the problem.

Convert each of the following 8-bit numbers to hexadecimal and then to octal a) 10011101 b) 00010101 c) 11100110 d) 01101001

Answers

Answer:

a) 10011101₂ = 9D₁₆ or 235₈

b) 00010101₂ = 15₁₆ or 025₈

c) 11100110₂ = E6₁₆ or 346₈

d) 01101001₂ = 69₁₆ or 151₈

Explanation:

An hexadecimal is a group of 4bits while an octal is a group of 3 bits. They are represented in the table below;

Table for conversion;

Octal   =>    binary

0         =>     000

1          =>     001

2          =>    010

3          =>    011

4          =>    100

5          =>    101

6          =>    110

7          =>    111

Hexadecimal   => binary

0                      =>     0000

1                       =>     0001

2                      =>     0010

3                      =>     0011

4                      =>     0100

5                      =>     0101

6                      =>     0110

7                      =>     0111

8                      =>     1000

9                      =>     1001

A                      =>    1010

B                      =>    1011

C                      =>    1100

D                      =>    1101

E                      =>    1110

F                      =>    1111

(a)

(i) Convert 10011101 to hexadecimal

Step 1: Starting from the right, split the number into groups of 4s as follows;

1001   1101

Step 2: Convert each of the groups into its equivalent hexadecimal using the table above;

1001 = 9

1101 = D

Step 3: Put them together;

1001 1101₂ = 9D₁₆

(ii) Convert 10011101 to octal

Step 1: Starting from the right, split the number into groups of 3s as follows;

10  011  101

Step 2: The last group (10) in the result of step 1 above has only 2 bits. Therefore, add zero to its left to make it 3 bits as follows;

010  011  101

Step 3: Convert each of the groups into its equivalent octal using the table above;

010 = 2

011 = 3

101 = 5

Step 4: Put them together;

10 011 101₂ = 235₈

(b)

(i) Convert 00010101 to hexadecimal

Step 1: Starting from the right, split the number into groups of 4s as follows;

0001   0101

Step 2: Convert each of the groups into its equivalent hexadecimal using the table above;

0001 = 1

0101 = 5

Step 3: Put them together;

0001 0101₂ = 15₁₆

(ii) Convert 00010101 to octal

Step 1: Starting from the right, split the number into groups of 3s as follows;

00  010  101

Step 2: The last group (00) in the result of step 1 above has only 2 bits. Therefore, add zero to its left to make it 3 bits as follows;

000  010  101

Step 3: Convert each of the groups into its equivalent octal using the table above;

000 = 0

010 = 2

101 = 5

Step 4: Put them together;

00 010 101₂ = 025₈

(c)

(i) Convert 11100110 to hexadecimal

Step 1: Starting from the right, split the number into groups of 4s as follows;

1110  0110

Step 2: Convert each of the groups into its equivalent hexadecimal using the table above;

1110 = E

0110 = 6

Step 3: Put them together;

1110 0110₂ = E6₁₆

(ii) Convert 11100110 to octal

Step 1: Starting from the right, split the number into groups of 3s as follows;

11 100 110

Step 2: The last group (11) in the result of step 1 above has only 2 bits. Therefore, add zero to its left to make it 3 bits as follows;

011 100 110

Step 3: Convert each of the groups into its equivalent octal using the table above;

011 = 3

100 = 4

110 = 6

Step 4: Put them together;

11 100 110₂ = 346₈

(d)

(i) Convert 01101001 to hexadecimal

Step 1: Starting from the right, split the number into groups of 4s as follows;

0110 1001

Step 2: Convert each of the groups into its equivalent hexadecimal using the table above;

0110 = 6

1001 = 9

Step 3: Put them together;

0110 1001₂ = 69₁₆

(ii) Convert 01101001 to octal

Step 1: Starting from the right, split the number into groups of 3s as follows;

01 101 001

Step 2: The last group (01) in the result of step 1 above has only 2 bits. Therefore, add zero to its left to make it 3 bits as follows;

001 101 001

Step 3: Convert each of the groups into its equivalent octal using the table above;

001 = 1

101 = 5

001 = 1

Step 4: Put them together;

01 101 001₂ = 151₈

________ programming is a method of writing software that centers on the actions that take place in a program.

Answers

Answer: Procedural software

Explanation:

Procedural software programming is the programming mechanism that functions through splitting the data and functions of the program.This programming focuses on subroutines or action for functioning as per call of procedure.

It can carry out computation through steps in linear manner or top-to-bottom manner.These steps consist of data ,subroutines, routines and other variable and functions for working.

Investigate the functions available in PHP, or another suitable Web scripting language, to interpret the common HTML and URL encodings used on form data so that the values are canonicalized to a standard form before checking or further use.

Answers

Answer:

Answer explained below

Explanation:

Solution:

Some of the PHP functions used to interpret common HTML and URL encodings are as follows:

urlencode:

This function is used for encoding a string to be used in a query part of a URL and this is used as a convenient way to pass variables to the next page of a web form.

urldecode(): Same as urlencode() but in a reverse way. It is used to decode URL-encoded string

htmlentities(): This PHP function is used to convert all applicable characters to HTML entities

html_entity_decode(): This function converts HTML entities to characters and it is the reverse form of htmlentities() function.

In the Budget Details sheet, if you wish to autofill with the formula, you must use a ______ reference for the LY Spend Total cell in your formula in order to calculate what percentage of the Total is Gasoline.

A. Absolute B. Circular C. Linking D. Relative

Answers

Answer:

The answer is A.Absolute reference.

Explanation:

Absolute reference is a cell reference whose location remains constant when the formula is copied.

How should this be accomplished? Business users have requested that the Salesforce Administrator allow agents to view a list of cases in the console while agents work through their cases. This will allow agents to identify urgent cases that need to be worked on.
A. Enable the list to be pinned in the console. This allows users to view the list alongside the case view in the console
B. Configure the Case list under custom console components so users can view the list view along with the case view.
C. Build a custom VisualForce page with the list view and assign it to the console sidebar.
D. Recommend opening the case list view in a separate browser tab and use the window alongside the case view.

Answers

Answer:

A)

Explanation:

Enable the list to be pinned in the console. This allows users to view the list alongside the case view in the console

Now imagine that we have a list of 5 employees who have each worked 45, 15, 63, 23, and 39 hours. We'll fix rate_of_pay at 10. Payroll wants to mail checks for each of these employees. Use a definite loop (for loop) to loop through the list of employee hours and print the appropriate pay statement. Your output should look something like: Paying 475.0 by direct deposit Paying 150.0 by mailed check Paying 630.0 by direct deposit Paying 230.0 by mailed check Paying 390.0 by direct deposit

Answers

Answer:

Hi there! The question is asking for a simple loop implementation that prints payment advice for Payroll.

Explanation:

Assuming that the payment method is “mailed check” for hours worked less than 30 and “direct deposit” for hours worked greater than 30, we can implement the function as below.  

 

hours_worked = [45, 15, 63, 23, 39]

payment_method = “mailed check”

for (int index = 0; index < 5; index++) {

   if hours_worked[index] > 30 {

      payment_method = “direct deposit”

   }

   print(“Paying “ + (hours_worked[index] * pay_rate) + “by “ + payment_method)

}

Final answer:

To calculate the payments for a list of employees with given worked hours, a for loop can be used to multiply each hour count by the fixed rate of pay and print alternating payment method statements.

Explanation:

Using a definite loop, such as a for loop in a programming language, we can easily calculate the individual paychecks for a list of employees and their respective hours worked. Assuming a fixed rate of pay of $10 per hour, we can loop through a list with the values 45, 15, 63, 23, and 39 to calculate the gross pay for each employee. Since our task is to print a statement for the method of payment, alternating between direct deposit and mailed check, we would end up with statements that reflect the total pay multiplied by the rate_of_pay. Below is a potential implementation of such a loop:


 Paying 450.0 by direct deposit
 Paying 150.0 by mailed check
 Paying 630.0 by direct deposit
 Paying 230.0 by mailed check
 Paying 390.0 by direct deposit

This example takes the given hours, multiplies them by the rate of pay, and prints out a statement that indicates the payment amount and method.

Identify two entities and 2 of their attributes from the given scenario.
Book.com is an online virtual store on the Internet where customers can browse the catalog and select products of interest.

Answers

Bookstore and BookSearch are the two entities for the given scenario.

Explanation:

For the given Book.com virtual store, there can be two entities like Bookstore and BookSearch.Bookstore can have all the details of the books in the virtual store. hence the attributes can be Bookstore attributes: bookname, Authorname, Publisher, Publishedyear, Agegroup, category.BookSearch entity can be used to search the books in the virtual store.Booksearch attributes: bookname, category, bookid, authorname.

Create a list of student names from area code 203 along with the number of years since they registered (show 2 decimal places on all values).
Sort the list on the number of years from highest to lowest and then on student name.
NOTE that the calculated number of years will vary from the expected results depending on when the query is run.

Answers

Answer:

Answer is provided in the explanation section

Explanation:

1. For testing this query, first create a table:

CREATE TABLE STUDENT (NAME CHARACTER(25), ROLLNO int PRIMARY KEY, AREACODE int, REGD_YEAR date)  

2. Insert some data for checking the query

 insert into student values(101,'Mark',203,'03-12-1997')  

            insert into student values(106,'Zack',204,'06-18-1992')

 insert into student values(104,'Jess',203,'01-11-1995')

3. Select query for creating a list of student names from area code 203

SELECT NAME AS "Student Name", AREACODE, REGD_YEAR

FROM STUDENT

WHERE AREACODE LIKE '203%'

ORDER BY “REGD_YEAR“,”Student Name”;

Write an expression that executes the loop body as long as the user enters a non-negative number. Note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds and report "Program end never reached." The system doesn't print the test case that caused the reported message. Sample outputs with inputs: 9 5 2 -1 Body Done.

Answers

To ensure a loop executes as long as the user inputs a non-negative number, you can utilize a while loop in your code. The loop should continue if the condition is true, where the input number is greater than or equal to zero. Here's a sample code snippet:

number = int(input('Enter a number: '))

while number >= 0:

   print('Body')

   number = int(input('Enter a number: '))

print('Done')

This loop begins by prompting the user to enter a number. The while condition checks if the entered number is non-negative (i.e., greater than or equal to zero). If the condition is met, the loop 'Body' is executed, followed by another prompt for the user to input a number. This process repeats until the user inputs a negative number, which causes the while loop to end, and the program prints 'Done' after exiting the loop. Using a break statement isn't necessary here because the loop condition naturally terminates when a negative number is entered.

A(n) ____ string contacts the data source and establishes a connection with the database using the Data Source Configuration Wizard. a. keyline b. connection c. linkage d. index

Answers

Answer:

Option(b) i.e "connection " is the correct answer for the given question.

Explanation:

In the visual basics of .Net when we want to establish the connection with the database we have to use the data configuration wizard. A connection is the string contacts of the data source that establishes a connection with the database.

The connection string connects the particular project to the data source configuration wizard. After creating the string we have to follow the steps on how to create the data set and connect with the database.

Option(a),Option(c) and Option(d) are not relate the connection of the database.

So the "connection" is the correct answer.

You are installing a webcam in the screen bezel of your laptop. Prior to disassembling the laptop, what other devices in the screen bezel should you be aware of? (Select all that apply.)a. Microphoneb. Inverterc. Touchpadd. WI-FI antenna

Answers

Answer:

a. Microphone

d. Wi-Fi antenna

Explanation:

The wifi antenna , is present in the screen bezel , and the two cables are connected to the motherboard and the wifi adapter .

Hence , we need to be aware of the wifi antenna , before installing the webcam .

Microphone , as in most of the laptop , the microphone is present just near the screen bezel , and hence , need to be aware of before the installation process of the webcam .

Answer:

The correct option is WIFI antenna.

What does Web content mining involve? a. Analyzing the PageRank and other metadata of a Web page b. Analyzing the pattern of visits to a Web site c. Analyzing the universal resource locator in Web pages d. Analyzing the unstructured content of Web pages

Answers

Answer:

d. Analyzing the unstructured content of Web pages

Explanation:

Web page mining is referred to that mining that  is used to extract the data or information from the web page. The main focus behind the web page mining is to discover all useful information from web pages.

The main objective of web page mining the unstructured data or content of the web pages.

All the other three option are not related with web content mining, so the correct option is D

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class ConversionCalculator extends JFrame
{

private final int window_WIDTH=500;
private final int window_HEIGHT=250;

private JTextField centimeterTxt=new JTextField(10);
private JTextField inchesTxt=new JTextField(10);
private JTextField metersTxt=new JTextField(10);
private JTextField yardsTxt=new JTextField(10);

private JPanel inputPanel=new JPanel();
private JPanel buttonPanel=new JPanel();

private JButton clearBtn=new JButton("Clear");
private JButton calculateBtn=new JButton("Caclculate");
private JButton exitBtn=new JButton("Exit");

//Constructor
public ConversionCalculator()
{
//set title
setTitle("Conversion Calculator");
//set size
setSize(window_WIDTH, window_HEIGHT);
//Call createGUIPanel
createGUIPanel();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//set visible true
setVisible(true);


}


//Create a GUI panel
private void createGUIPanel()
{

JPanel guiPanel=new JPanel();
guiPanel.setLayout(new GridLayout(1, 2));


//Add controls to the input panel
inputPanel.setLayout(new GridLayout(2, 4));
inputPanel.add(new JLabel("Centimeters"));
centimeterTxt.setText("0.00");
inputPanel.add(centimeterTxt);
inputPanel.add(new JLabel("Inches"));
inchesTxt.setText("0.00");
inputPanel.add(inchesTxt);

inputPanel.add(new JLabel("Meters"));
metersTxt.setText("0.00");
inputPanel.add(metersTxt);
inputPanel.add(new JLabel("Yards"));
yardsTxt.setText("0.00");
inputPanel.add(yardsTxt);

//Add controls to the button panel
buttonPanel.setLayout(new GridLayout(3, 1));
clearBtn.addActionListener(new ClearButtonListener());
buttonPanel.add(clearBtn);
calculateBtn.addActionListener(new CalculateButtonListener());
buttonPanel.add(calculateBtn);
exitBtn.addActionListener(new ExitButtonListener());
buttonPanel.add(exitBtn);


//Add input panale to guipanel
guiPanel.add(inputPanel);
//Add button panel to the guipanel
guiPanel.add(buttonPanel);

add(guiPanel);

pack();
}

/*Inner class that implements action listener for exit button that
close the application */
private class ExitButtonListener implements ActionListener
{
@Override
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}

}

/*Inner class that implements action listener for calculate button that
converts the centimeters to inches and meters to yards */
private class CalculateButtonListener implements ActionListener
{

@Override
public void actionPerformed(ActionEvent e)
{
//Check if centimeters is not 0.00
if(!centimeterTxt.getText().equals("0.00"))
{
double centimeters=Double.parseDouble(centimeterTxt.getText());
//convert inches
double inches=centimeters*0.3937;
//set inches textfield
inchesTxt.setText(String.valueOf(inches));
//convert yards

}
//Check if meters is not 0.00
if(!metersTxt.getText().equals("0.00"))
{
double meters=Double.parseDouble(metersTxt.getText());
//convert yards
double yards=meters*1.0936;
//set yardTxt textfield
yardsTxt.setText(String.valueOf(yards));
//convert inches

}
}

}


/*Inner class that implements action listener for clear button that
resets the textfields to zero */
private class ClearButtonListener implements ActionListener
{
@Override
public void actionPerformed(ActionEvent e)
{
centimeterTxt.setText("0.00");
inchesTxt.setText("0.00");
metersTxt.setText("0.00");
yardsTxt.setText("0.00");
}
}

}

The former code is the current code I have. The following is what needs to be changed.

Implement the following event handling routines using Action Listeners

When the user enters 10 at the "Inches" JTextField and clicks the "Calculate" button.

a.Using the following equations, convert the entered length to other scales and then display on the corresponding .

1 inch = 2.54 cm

1 inch = 0.0278 yard

1 cm = 0.01 meter

NOTE: If you have trouble with these unit conversions and cannot get a hold of the instructor or TA, feel free to look up the conversions on Google.

b.All values must be rounded to two decimal places and then displayed. One way to accomplish this would be a DecimalFormat object.

This is the sample of the output needed

Answers

Answer:

public class ConversionCalculator extends JFrame {

  private JLabel inch_Label, meter_Label, cm_Label, yard_Label;

  private JButton clear, calculate, exit;

  private JTextField inch_tf, cm_tf, meters_tf, yards_tf;

 

  public ConversionCalculator()

  {

     

      exitButtonHandler exitB;

      clearButtonHandler clearB;

      calcButtonHandler calcB;

     

      setTitle("Conversion Calculator");

      setSize(600,200);

      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

     

      //The first layout we use will be 1 row with three columns

      setLayout(new GridLayout(1,3));

     

      //initialize all the components

      inch_Label = new JLabel("Inches");

      meter_Label = new JLabel("Meters");

      cm_Label = new JLabel("Centimeters");

      yard_Label = new JLabel("Yards");

      clear = new JButton("Clear");

      calculate = new JButton("Calculate");

      exit = new JButton("Exit");

      inch_tf = new JTextField("0.00");

      cm_tf = new JTextField("0.00");

      meters_tf = new JTextField("0.00");

      yards_tf = new JTextField("0.00");

 

      JPanel panel1 = new JPanel();

      panel1.setLayout(new GridLayout(2,2));

      JPanel panel2 = new JPanel();

      panel2.setLayout(new GridLayout(2,2));

      JPanel panel3 = new JPanel();

      panel3.setLayout(new GridLayout(3,1));

      panel1.add(cm_Label);

      panel1.add(cm_tf);

      panel1.add(meter_Label);

      panel1.add(meters_tf);

     

      panel2.add(inch_Label);

      panel2.add(inch_tf);

      panel2.add(yard_Label);

      panel2.add(yards_tf);

     

      panel3.add(clear);

      panel3.add(calculate);

      panel3.add(exit);

     

      add(panel1);

      add(panel2);

      add(panel3);

     

     

      exitB = new exitButtonHandler();

      exit.addActionListener(exitB);

     

      clearB = new clearButtonHandler();

      clear.addActionListener(clearB);

     

      calcB = new calcButtonHandler();

      calculate.addActionListener(calcB);

     

      setVisible(true);

  }

 

  //public static void main(String[] args)

     // {

       // new ConversionCalculator();

      //}

 

  private class exitButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          //exits program

          System.exit(0);

      }

  }

 

  private class clearButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          //clear button sets all text fields to 0

          inch_tf.setText("0.00");

          meters_tf.setText("0.00");

          yards_tf.setText("0.00");

          cm_tf.setText("0.00");

      }

  }

 

  private class calcButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          double inches, yards, meters, cms;

          DecimalFormat df = new DecimalFormat("0.00");

         

          //parse strings in textbox into doubles

          inches = Double.parseDouble(inch_tf.getText());

          yards = Double.parseDouble(yards_tf.getText());

          meters = Double.parseDouble(meters_tf.getText());

          cms = Double.parseDouble(cm_tf.getText());

         

          //we check which value has been tampered with and base our conversion off this

          //because of this it is important that the user clears, or else it will do inch conversion

          if(inches != 0.00)

          {

              cms = inches * 2.54;

              meters = cms / 100;

              yards = inches / 36;

             

              cm_tf.setText(df.format(cms));

              meters_tf.setText(df.format(meters));

              yards_tf.setText(df.format(yards));

             

          }

          else if(yards != 0.00)

          {

              inches = yards / 36;

              cms = inches * 2.54;

              meters = cms / 100;

             

              cm_tf.setText(df.format(cms));

              meters_tf.setText(df.format(meters));

              inch_tf.setText(df.format(inches));

          }

          else if(meters != 0.00)

          {

              cms = meters * 100;

              inches = cms / 2.54;

              yards = inches / 36;

             

              cm_tf.setText(df.format(cms));

              inch_tf.setText(df.format(inches));

              yards_tf.setText(df.format(yards));

          }

          else if(cms != 0.00)

          {

              inches = cms / 2.54;

              yards = inches / 36;

              meters = cms / 100;

             

              meters_tf.setText(df.format(meters));

              inch_tf.setText(df.format(inches));

              yards_tf.setText(df.format(yards));

          }

      }

  }

}

Explanation:

Inside the action performed method, pass the strings in text box.check if the value has been modified then do the relevant conversions inside the conditional statement.When the user clears, it will not do to the inch conversion.

Write a function listLengthOfAllWords which takes in an array of words (strings), and returns an array of numbers representing the length of each word.

Answers

Answer:

   public static int[] listLengthOfAllWords(String [] wordArray){

       int[] intArray = new int[wordArray.length];

       for (int i=0; i<intArray.length; i++){

           int lenOfWord = wordArray[i].length();

           intArray[i]=lenOfWord;

       }

       return intArray;

   }

Explanation:

Declare the method to return an array of ints and accept an array of string as a parameterwithin the method declare an array of integers with same length as the string array received as a parameter.Iterate using for loop over the array of string and extract the length of each word using this statement  int lenOfWord = wordArray[i].length();Assign the length of each word in the String array to the new Integer array with this statement intArray[i]=lenOfWord;Return the Integer Array

A Complete Java program with a call to the method is given below

import java.util.Arrays;

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

      String []wordArray = {"John", "James", "David", "Peter", "Davidson"};

       System.out.println(Arrays.toString(listLengthOfAllWords(wordArray)));

       }

   public static int[] listLengthOfAllWords(String [] wordArray){

       int[] intArray = new int[wordArray.length];

       for (int i=0; i<wordArray.length; i++){

           int lenOfWord = wordArray[i].length();

           intArray[i]=lenOfWord;

       }

       return intArray;

   }

}

This program gives the following array as output: [4, 5, 5, 5, 8]

A (n) _____, similar to a trojan horse, installs monitoring software in addition to the regular software that a user downloads or buys. Internet worm Bot Middleware Spyware

Answers

Answer:

Spyware

Explanation:

Internet is a type of computer network that allow device communicate with each other world wide. So, it is not the correct option.

Worm: this is a standalone malware computer program that replicates itself in order to spread to other computers. It spreads copies of itself from computer to computer. A worm can replicate itself without any human interaction, and it does not need to attach itself to a software program in order to cause damage. The major feature of a worm is ability to replicate on it own. So, it is not the correct option.

Bot: this is a software application that runs automated tasks. So, it is not the correct option.

Middleware: this is software that lies between an operating system and the applications running on it, enabling communication and data management. It provides services to software applications beyond those available from the operating system. So, it is not the correct option.

Spyware: this is the correct answer. Spyware is similar to trojan horse because it hides itself in a system and a user may not know that it exist on the system. Spyware is a form of malware that hides on your device, monitors your activity, and steals sensitive information without knowledge of the user.

Answer:

Spyware

Explanation:

Computer network systems are intercommunication of connected devices, to share resources within and to other remote networks. Network security policies and technical control system technologies are used by a network or system administrator to prevent unauthorized and unauthenticated access to user account in the network by cyber attackers.

Cyber attackers are individuals or group of individuals with the traditional hacking skills to exploit network and system vulnerabilities, to steal information. Malwares are used by hackers to covertly access networks. The spyware is a monitoring Trojan horse malware, used to monitor the activities of a user, steal information for fraudulent purposes.

A computer system uses passwords that are six characters and each character is one of the 26 letters (a-z) or 10 integers (0-9). Uppercase letters are not used. Let A denote the event that a password begins with a vowel (either a, e, i, o, u) and let B denote the event that a password ends with an even number (either 0, 2, 4, 6, or 8). Suppose a hacker selects a password at random. Determine the following probabilities. Round your answers to four decimal places (e.g. 98.7654).

Answers

Question continuation

Determine the following probabilities:

a. P(A)

b. P(B)

c. P(A ∩ B)

d. P(A ∪ B)

Answer:

a. P(A) = 0.1389

b. P(B) = 0.1389

c. P(AnB) = 0.0193

d. P(AuB) = 0.2585

Explanation:

Given

Password length = 6

Letters (a-z) = 26

Integers (0-9) = 10

Total usable characters = 26 + 10 = 36

a. P(A) = Probability that a password begins with vowel (a,e,i,o,u)

Probability = Number of required outcomes/ Number of possible outcomes

Number of required outcomes = Number of vowels = 5

Number of possible outcomes = Total usable characters = 36

P(A) = 5/36

P(A) = 0.13888888888

P(A) = 0.1389

b. P(B) = Probability that the password ends with an even number (0,2,4,6,8)

Probability = Number of required outcomes/ Number of possible outcomes

Number of required outcomes = Number of even numbers = 5

Number of possible outcomes = Total usable characters = 36

P(B) = 5/36

P(B) = 0.13888888888

P(B) = 0.1389

c. P(AnB)

This means that the probability that a password starts with a vowel and ends with an even number

P(AnB) = P(A) and P(B)

P(AnB) = P(A) * P(B)

P(AnB) = 5/36 * 5/36

P(AnB) = 25/1296

P(AnB) = 0.01929012345

P(AnB) = 0.0193 ----_---- Approximately

d. P(AuB)

This means that the probability that a password either starts with a vowel or ends with an even number

P(AuB) = P(A) or P(B)

P(AuB) = P(A) + P(B) - P(AnB)

P(AuB) = 5/36 + 5/36 - 25/1296

P(AuB) = 335/1296

P(AuB) = 0.25848765432

P(AuB) = 0.2585 ----_---- Approximately

Final answer:

Calculating the probability of events A and B for passwords satisfying specific conditions.

Explanation:

A denote the event that a password begins with a vowel and B denote the event that a password ends with an even number. The total number of possible passwords is 36^6 (26 letters + 10 integers). To determine the probability of A, we calculate the number of passwords that start with a vowel (5 vowels) followed by any character (36 options) for the remaining 5 characters. Similarly, to find the probability of B, we consider passwords that end with an even number (5 options) and any character for the other 5 places.

Probability of A = (5 * 36^5) / 36^6
Probability of B = (5 * 36^5) / 36^6

Design a class named Triangle that extends GeometricObject:import java.util.Scanner;abstract class GeometricObject {private String color = "white";private boolean filled;private java.util.Date dateCreated;/** Construct a default geometric object */protected GeometricObject() {}/** Construct a geometric object with color and filled value */protected GeometricObject(String color, boolean filled) {dateCreated = new java.util.Date();this.color = color;this.filled = filled;}/** Return color */public String getColor() {return color;}/** Set a new color */public void setColor(String color) {this.color = color;}/** Return filled. Since filled is boolean ,* the get method is named isFilled */public boolean isFilled() {return filled;}/** Set a new filled */public void setFilled(boolean filled) {this.filled = filled;}/** Get dateCreated */public java.util.Date getDateCreated() {return dateCreated;}@Overridepublic String toString() {return "created on " + dateCreated + "\ncolor: " + color +" and filled: " + filled;}/** Abstract method getArea */public abstract double getArea();/** Abstract method getPerimeter */public abstract double getPerimeter();}The Triangle class contains:Three double data fields named side1, side2, and side3A default constructor that creates a triangle with three sides of length 1.0A constructor that creates a triangle with specified values for side1, side2, and side3Accessor methods for all three data fieldsA method called getArea() that returns the area of a triangleA method named getPerimeter() that returns the perimeter of the triangleA method named toString() that returns the string description of the triangle in the following format: "Triangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3;Test your Triangle class in a Drive program (in the same file) that prompts the user to enter the three sides of the triangle, the color, and whether or not the triangle is filled. The program should create a Triangle object with these sides and set the color and filled properties. Then, it should display the area, perimeter, color, and filled value .

Answers

Answer:

Hi there Collegebound! The implementation of the Triangle class and the Drive program is below. Copy the code below into the file Triangle.java and then compile it with the command: "javac Triangle.java". To run the program, type the command: "java Drive". You should see the following result if you test with the same inputs:

$java Drive

Enter side 1 of the triangle:

1

Enter side 2 of the triangle:

1

Enter side 3 of the triangle:

1

Enter color of the triangle:

orange

Enter if triangle is filled:

true

Area of Triangle is: 0.4330127018922193

Perimeter of Triangle is: 3.0

Color of Triangle is: orange

Triangle is filled: true

Explanation:

import java.lang.Math;

import java.util.Scanner;

public class Triangle extends GeometricObject {

 double side1, side2, side3;

 protected Triangle() {}

 protected Triangle(double s1, double s2, double s3) {

   this.side1 = s1;

   this.side2 = s2;

   this.side3 = s3;

 }

 public double getSide1() {

   return side1;

 }

 public double getSide2() {

   return side2;

 }

 public double getSide3() {

   return side3;

 }

 public double getArea() {

   /* use Heron's formula */

   double s = (this.side1 + this.side2 + this.side3) / 2;

   double area = Math.sqrt(s*((s-this.side1)*(s-this.side2)*(s-this.side3)));

   return area;

 }

 public double getPerimeter() {

   return side1+side2+side3;

 }

 @Override

 public String toString() {

   return "Triangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3;

 }

}

class Drive {

 public static void main(String args[]) {

   double side1, side2, side3;

   System.out.println("Enter side 1 of the triangle: ");

   Scanner scan = new Scanner(System.in);

   side1 = scan.nextDouble();

   System.out.println("Enter side 2 of the triangle: ");

   scan = new Scanner(System.in);

   side2 = scan.nextDouble();

   System.out.println("Enter side 3 of the triangle: ");

   scan = new Scanner(System.in);

   side3 = scan.nextDouble();

   System.out.println("Enter color of the triangle: ");

   scan = new Scanner(System.in);

   String color = scan.next();

   System.out.println("Enter if triangle is filled: ");

   scan = new Scanner(System.in);

   Boolean isFilled = scan.nextBoolean();

   Triangle triangle = new Triangle(side1, side2, side3);

   triangle.setColor(color);

   triangle.setFilled(isFilled);

   System.out.println("Area of Triangle is: " + triangle.getArea());

   System.out.println("Perimeter of Triangle is: " + triangle.getPerimeter());

   System.out.println("Color of Triangle is: " + triangle.getColor());

   System.out.println("Triangle is filled: " + triangle.isFilled());

 }

}

Final answer:

A Triangle class in Java entails creating a subclass of GeometricObject with fields for its sides, methods to calculate its area and perimeter, and an overridden toString method. Test the class with a program that gathers user inputs to instantiate a triangle and display its attributes.

Explanation:

The student's question pertains to the construction of a Triangle class in Java that extends a given GeometricObject abstract class. To design this class, one must include three data fields representing the sides of the triangle, constructors for default and specified values, accessor methods for the sides, a method to calculate the area of the triangle, a method to calculate the perimeter, and an override of the toString method to describe the triangle.

The test program will prompt the user for inputs regarding the sides, color, and fill of the triangle and will use this information to create a Triangle object and display its attributes.

Example Implementation:

public class Triangle extends GeometricObject {
   private double side1 = 1.0, side2 = 1.0, side3 = 1.0;
   public Triangle() {}
   public Triangle(double side1, double side2, double side3) {
       this.side1 = side1;
       this.side2 = side2;
       this.side3 = side3;
   }
   // Accessor methods
   public double getSide1() {
       return side1;
   }
   public double getSide2() {
       return side2;
   }
   public double getSide3() {
       return side3;
   }
   // Area calculation using Heron's formula
   public double getArea() {
       double s = (side1 + side2 + side3) / 2;
       return Math.sqrt(s * (s - side1) * (s - side2) * (s - side3));
   }
   // Perimeter calculation
   public double getPerimeter() {
       return side1 + side2 + side3;
   }
   // Description of Triangle
   Override
   public String toString() {
       return "Triangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3;
   }
}

To test the Triangle class, one can implement a Driver program within the same file that uses a Scanner to collect user input, initializes a Triangle object, sets its attributes, and finally prints the area, perimeter, color, and filled status.

List at least five tasks a layer performs. Could one (or more) of these tasks could be performed by multiple layers?

Answers

Answer:

Transport layer:

- data packets are segment to smaller chunks.

- gives sequence number to segment.

- identifies the source and destination port number.

- initiates data transmission between nodes.

- rearrange and identifies the application, the transmitted data is meant for.

Explanation:

The transport layer is the fourth layer in the OSI network model. Protocols like TCP and UDP are found in this layer. It segment data packets and for a connection oriented protocol like TCP, it creates an established session between source and destination host (the session layer can also do this, but it is more defined in the transport layer).

The network and data-link layer can also transmit data packets.

java Problem: The TARDIS has been infected by a virus which means it is up to Doctor Who to manually enter calculations into the TARDIS interface. The calculations necessary to make the TARDIS work properly involve real, imaginary and complex numbers. The Doctor has asked you to create a program that will evaluate numerical expressions so that he can quickly enter the information into the TARDIS. Details:

Answers

Answer:

import java.io.FileNotFoundException;

import java.io.FileReader;

import java.util.HashMap;

import java.util.Scanner;

import java.util.concurrent.SynchronousQueue;

import java.util.regex.Matcher;

import java.util.regex.Pattern;

public lass Test

{

public static void main(String[] args) {

FileReader fr;

try {

fr = new FileReader("expression.txt");

Scanner sc=new Scanner(fr);

while(sc.hasNextLine())

{

String line=sc.nextLine();

pareseString(line);

pareseString(line);

}

} catch (FileNotFoundException e) {

e.printStackTrace();

}

pareseString("6 * 3+2i");

pareseString("2 - 3");

}

public static ComplexNumber add(ComplexNumber c1, ComplexNumber c2) {

return new ComplexNumber(c1.getRealNumber() + c2.getRealNumber(), c1.getImaginaryNumber() + c2.getImaginaryNumber());

}

public static ComplexNumber substract(ComplexNumber c1, ComplexNumber c2) {

return new ComplexNumber(c1.getRealNumber() - c2.getRealNumber(), c1.getImaginaryNumber() - c2.getImaginaryNumber());

}

public static ComplexNumber multiply(ComplexNumber c1,ComplexNumber c2) {

ComplexNumber c3 = new ComplexNumber();

c3.setRealNumber( c1.getRealNumber() * c2.getRealNumber() - c1.getImaginaryNumber() * c2.getImaginaryNumber());

c3.setImaginaryNumber( c1.getRealNumber() * c2.getImaginaryNumber() - c1.getImaginaryNumber() * c2.getRealNumber());;

return c3;

}

public static ComplexNumber divide(ComplexNumber c1,ComplexNumber c2) {

ComplexNumber c3 = new ComplexNumber();

c3.setRealNumber( c1.getRealNumber() / c2.getRealNumber() - c1.getImaginaryNumber() / c2.getImaginaryNumber());

c3.setImaginaryNumber( c1.getRealNumber() / c2.getImaginaryNumber() - c1.getImaginaryNumber() / c2.getRealNumber());;

return c3;

}

public static void pareseString(String line)

{

String [] strArr=line.split(" ");

String cn1=strArr[0];

String operation=strArr[1];

String cn2=strArr[2];

ComplexNumber c1=validation(cn1);

ComplexNumber c2=validation(cn2);

if(c1!=null && c2!=null)

{

switch (operation) {

case "+":

System.out.println(add(c1, c2));

break;

case "-":

System.out.println(substract(c1, c2));

break;

case "*":

System.out.println(multiply(c1, c2));

break;

case "/":

System.out.println(divide(c1, c2));

break;

}

}

}

private static ComplexNumber validation(String comp) {

String numberNoWhiteSpace = comp.replaceAll("\\s","");

Pattern patternA = Pattern.compile("([-]?[0-9]+\\.?[0-9]?)([-|+]+[0-9]+\\.?[0-9]?)[i$]+");

Pattern patternB = Pattern.compile("([-]?[0-9]+\\.?[0-9]?)$");

Pattern patternC = Pattern.compile("([-]?[0-9]+\\.?[0-9]?)[i$]");

Matcher matcherA = patternA.matcher(numberNoWhiteSpace);

Matcher matcherB = patternB.matcher(numberNoWhiteSpace);

Matcher matcherC = patternC.matcher(numberNoWhiteSpace);

double realNumber=0.0;

double imaginaryNumber=0.0;

ComplexNumber cn=null;

if (matcherA.find()) {

realNumber = Double.parseDouble(matcherA.group(1));

imaginaryNumber = Double.parseDouble(matcherA.group(2));

cn=new ComplexNumber(realNumber, imaginaryNumber);

} else if (matcherB.find()) {

realNumber = Double.parseDouble(matcherB.group(1));

imaginaryNumber = 0;

cn=new ComplexNumber(realNumber, imaginaryNumber);

} else if (matcherC.find()) {

realNumber = 0;

imaginaryNumber = Double.parseDouble(matcherC.group(1));

cn=new ComplexNumber(realNumber, imaginaryNumber);

}

return cn;

}

}

class Number

{

private double realNumber;

public Number(double realNumber) {

this.realNumber= realNumber;

}

public Number() {

this.realNumber= realNumber;

}

 

public double getRealNumber() {

return realNumber;

}

 

public void setRealNumber(double realNumnber) {

this.realNumber = realNumnber;

}

 

@Override

public String toString() {

return this.getRealNumber()+"";

}

@Override

public boolean equals(Object obj) {

if(obj instanceof Number)

{

Number cn=(Number)obj;

return this.getRealNumber()==cn.getRealNumber();

}

return false;

}

}

class ComplexNumber extends Number

{

public double getImaginaryNumber() {

return imaginaryNumber;

}

 

public void setImaginaryNumber(double imaginaryNumber) {

this.imaginaryNumber = imaginaryNumber;

}

double imaginaryNumber;

public ComplexNumber(double realNumnber,double imaginaryNumber) {

super(realNumnber);

this.imaginaryNumber=imaginaryNumber;

}

public ComplexNumber() {

super();

}

@Override  

public String toString() {

return this.getRealNumber()+"+"+this.getImaginaryNumber()+"i";

}

@Override

public boolean equals(Object obj) {

if(obj instanceof ComplexNumber)

{

ComplexNumber cn=(ComplexNumber)obj;

return this.getRealNumber()==cn.getRealNumber() && cn.getImaginaryNumber()==this.getImaginaryNumber();

}

return false;

}

}

Explanation:

Create the add method, that takes object c2 as parameter.

Create the subtract method, followed by the methods to multiply and divide.

Create a regular expression that matches complex number with BOTH real AND imaginary parts.

Answer:

tell him to do it himself and call him lazy

(i know im a genius)

Decide what factors are important in your decision as to which computer to buy and list them. After you select the system you would like to buy, identify which terms refer to hardware and which refer to software.

Answers

Answer and explanation:

When buying a computer, there are a few factors that sould be taken into account. Those could be the following ones:

Bulkiness (hardware)Operating system (software)Processor (CPU) (hardware)RAM (Random Access Memory) (hardware)Hard drive (hardware)
Final answer:

When deciding which computer to buy, important factors to consider are price, performance, operating system, usage, portability, and brand and support. Hardware refers to physical components, while software refers to programs and applications.

Explanation:

When deciding which computer to buy, there are several factors to consider. These include:

Price: Determine your budget and choose a computer within that range.Performance: Consider the processor, memory, and storage capacity of the computer. Higher specifications usually result in better performance.Operating System: Decide whether you prefer Windows, macOS, or Linux based on your needs and preferences.Usage: Determine the purpose of the computer. Are you planning to use it for gaming, programming, video editing, or just basic tasks?Portability: Decide whether you need a desktop or a laptop based on your mobility requirements.Brand and Support: Research different brands and read reviews to ensure good customer support and reliability.

After selecting the system you would like to buy, you should identify which terms refer to hardware and which refer to software. Hardware refers to the physical components of a computer, such as the hard drive, processor, memory, and motherboard. Software refers to the intangible programs or applications that run on the computer, such as operating systems, utilities, and applications.

Other Questions
If someone were to describe "The Rosetta Stone" to a friend, he or she would most likely compare it toO a mystery novel.a fantasy novel.a romance novel.an adventure novel. Courtney is picking out material for her new quilt. At the fabric store, there are 9 solids, 7 striped prints, and 5 floral prints that she can choose from. If she needs 2 solids, 4 floral prints, and 4 striped fabrics for her quilt, how many different ways can she choose the materials? A total of $114,000 will be evenly spent to build 12 Bungalows. If the first 5 bungalows have been completed and paid for, then __?__ is still available for the remaining bungalows. If you wanted to repeat your experiment, you could do it once, then do it again, and so on. You could also _____.A.complete more than one trial at onceB.pick a procedure that takes less time to completeC.ask another group of scientists to do the same experimentD.copy your results several times and change the numbers a bitl trial What novel insight did Mencius bring to Confucius thought?A. Human nature is not a factor in determining whether someone is GoodB. Different cultures may disagree on the appropriate rituals and ritesC. Human nature is essentially and innately goodD. One ought to love everyone as if they were a sibling Economic models are: a. useless if they are simple. b. potentially useful in forming economic policy. c. made generally of wood, plastic, and/or metal. d. set up and used to precisely mirror reality. A person jumps from the roof of a house 3.5-m high. When he strikes the ground below, he bends his knees so that his torso decelerates over an approximate distance of 0.71 m .If the mass of his torso (excluding legs) is 45 kg , find the magnitude of the average force exerted on his torso by his legs during deceleration. the process of clearly identifying how a variable is measured is referred to as Drew contracts to sell a house to Evan. The contract provides that if Drew does not sell the house by February 10, he must pay Evan one-half of the contract price. This provision is not enforceable because it is ________.a. a liquidated damages clause.b. a material breach.c. a mitigation of damages.d. a penalty clause. Which of the following is NOT a differentiator between manufacturing and service operations? A. Transportation B. Customer contact C. Resale D. Cost per unit 4. In order to attract businesses to the area, the city of Grand Valley offers a $500 job tax credit per employee, a 3% investment tax credit for purchased equipment and a health insurance tax credit of $200 per employee. This is an example of a(n)____________ WILL GIVE BRAINLIESTWhat is the number of possible outcomes if two quarters are tossed at the same time and the numbers of heads and tails are counted?A) 2B) 3C) 4D) 62)Caroline flips a coin 3 times. According to the tree diagram, how many possible outcomes exist?A) 2B) 4C) 6D) 83)Kyle is purchasing a refurbished phone. He is looking at the phone models 4, 5, and 6, with a protective case in red (R), blue (B), or camo (C). What are all of the different choices he has?A) {4, 5, 6}B) {4R, 5B, 6C}C) {4R, 4B, 4C, 5R, 5B, 5C}D) {4R, 4B, 4C, 5R, 5B, 5C, 6R, 6B, 6C}4)You are going to roll two dice What are the outcomes in the sample space?A) {1, 2, 3, 4, 5, 6}B) {2, 4, 6, 8, 10, 12}C) {1-1, 2-2, 3-3, 4-4, 5-5, 6-6}D) {1-1, 1-2, 1-3, 1-4, 1-5, 1-6, 2-2, 2-3, 2-4, 2-5, 2-6, 3-3, 3-4, 3-5, 3-6, 4-4, 4-5, 4-6, 5-5, 5-6, 6-6}5)Hannah is getting dressed for a party. She plans to wear either shorts or jeans, a red, blue or green shirt, and flip flops or tennis shoes. According to the tree diagram, how many possible outfits can she make?A) 8B) 10C) 12D) 141st pic is 2nd q and 2nd pic is for 5th q 5(n + 3) -7n when n = 1/2 1. How would you describe the tone and purposeof these excerpts from McNeil's oral history? How do I solve this? Please show steps clearly so i can understand, thank you Create a short story (one or half a page) (no less) with 9 vocabulary words. Here are 20 words so choose 9 (or more) and here are the definitions I need them to represent. Please help me!!!!!crown an English coin worth 5 shillings public house tavern consisting of a building with a bar and public rooms gipsy a laborer who moves from place to place as demanded by employment temperament excessive emotionalism or irritability and excitability surfeit the state of being more than full criticize point out real or perceived flaws gorgonzola Italian blue cheese amiable diffusing warmth and friendliness wallop hit hard bloke a boy or man pedigree ancestry of a purebred animal shilling a former monetary unit in Great Britain coincidence the property of two things happening at the same time mope be apathetic, gloomy, or dazed pip a minor nonspecific ailment peculiarity an odd or unusual characteristic morbid suggesting an unhealthy mental state peevish easily irritated or annoyed chump a person who is gullible and easy to take advantage of sterling highest in quality Shawn McGill is on the executive board for ABC pharmaceuticals. The company produces the number-one-selling cancer-ghting drug on the market. Due to its incredible success, ABC Pharmaceuticals has decided to increase the cost of thedrug from $8 a pill to $15 a pill. Which force is ABC Pharmaceutical using to increase its drug price?A. Supplier power.B. Buyer power.C. Threat of false entrants.D. Business power. FIRST ONE IN UNDER 5 MIN GET BRAINISLIT THING! A Big YearBy Bob KowalskiWould you go to the ends of the earth to see a bird? What if it were a really special bird: one with beautiful feathers, an entrancing call, or a silly dance? What if seeing that one special bird would allow you to win a contest?If that contest doesn't get you on television or win you any cash prizes, would you still do it? For those who participate in the "Big Year," the honor of beating the previous record is the only reward they get or even want.A "Big Year" is a year in which a person attempts to see as many different species of birds as possible within a particular region. For most in North America who participate in a "Big Year," this region is the lower 48 American states, plus Alaska, Canada, and a couple of French islands off the Canadian coast.You may be thinking that looking at birds is silly, but just think about the numbers of the recent record holders and the commitment it takes to get these numbers. One recent "Big Year" winner managed to see 744 birds in one year, missing the record by just one bird. Big Year birders travel by train, plane, boat, car, bicycle, and of course, by foot. They can cover over 150 thousand miles to get numbers of sightings this high. They can also spend a small fortune.Just to clarify, the birds these contestants are counting are the number that they see in a particular year. You see, the contest is based on an honor system. No pictures or other evidence is required as proof of a sighting. Most birders take great pride in their reputation and their abilities to see or hear and then identify a bird. Usually, important sightings of the rare birds needed to get counts in the 700s are visited by hundreds of birders. It is pretty hard to cheat your way to a record-breaking year, but in general, few are interested in cheating.This honesty comes from the fact that most people who want to break such a record know the greatest rewards are not necessarily in winning. Such rewards are in being able to commit a year of your life to doing something you love. Rewards are found in seeing amazing, inspiring creatures like the California Condor or the Magnificent Frigate bird. Rewards also come in spending time with people who, like you, want to spend their time looking to the skies and trees for glimpses of emerald, crimson, or cerulean blue feathered jewels.You don't have to be able to travel a continent to have a big birding experience though. Have a big month. Or a big weekend. Set a personal record, learn to identify the species that live in your part of the world, or try to learn the calls of just two species of birds. You will soon find looking at birds isn't such a strange way to spend your time.Extra! Extra! Backyard BirdingMany schools, families, and young birders across the country participate in the "Great Backyard Bird Count." While not as long as a "Big Year," the "Great Backyard Bird Count" happens every year. It depends on birders and families across the country to watch feeders and other areas in their yards and count the number of birds they see. Unlike the "Big Year," the goal is not to see who can count the most birds. Instead, participants in this event work together to help bird experts get a good idea of how birds are doing. Participants are given checklists and enter their sightings on a website. Called a "citizen-science" project, this event is open to anyone, requires no travel, and happens every year over one weekend in February.Why does the author include explanations for why people compete in a Big Year? To convince readers birding is rewarding in many ways To imply birders should get more respect To suggest birders have strange hobbies To suggest readers may have similar reasons what impact did the emergence of buddhism and jainism have on ancient india? PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!Using the table below, describe the various characters and their perspectives in the story. Type one to three traits in each box. In the columnlabeled "Evidence from the Text," enter quotations from the excerpt to support your descriptions.