Questions
how to get this to not consider 0, 1 and negative integers as prime. maybe using...

how to get this to not consider 0, 1 and negative integers as prime. maybe using a "nested loop" or more than one loop?

//TestCode.java import java.util.Scanner; public class TestCode { public static void main(String[] args) { // Creating scanner object Scanner scan = new Scanner(System.in); boolean isPrime; int x; // Declaring an array with 10 ints int arr[] = new int[10]; // Reading values from user System.out.println("Enter 10 integer values for array:"); for(int i = 0;i<arr.length;i++){ arr[i] = scan.nextInt(); } // Looping through each value in array for(int i = 0;i<arr.length;i++){ x = arr[i]; // Assuming x is prime isPrime = true; // Loop through 2 to x-1 for(int j = 2;j<x;j++){ // if x is divisible by any of j if(x%j == 0) { // Then setting isPrime to false isPrime = false; } } // Printing value of x if it is a prime if(isPrime){ System.out.println(x); } } } }

In: Computer Science

Exploring Web-based Programs and Apps Use Google to find information about web-based programs and apps to...

Exploring Web-based Programs and Apps

Use Google to find information about web-based programs and apps to answer the following questions:

  1. Find articles comparing the features of Google Drive and Office Web Apps.
  2. What different tools does each offer?
  3. Are there costs associated with using these resources?
  4. Do they offer any premium services?
  5. Are there any known security issues?

In: Computer Science

This is in Python, I am trying to create a new window to print the data...

This is in Python, I am trying to create a new window to print the data to screen, it prints fine in the terminal. I know this is a small segment of my code and its the only portion I am having a problem with. I was wondering if anyone can see what my problem may be. The current issue is

NameError: name 'fltVal' is not defined and AttributeError: 'PressureGUI' object has no attribute 'r_count'

Any help would be appreciated Based on the comment I made some changes which got me past the error above

The updated code is now with a new error of

File "/Volumes/NO NAME/CSE-222/Data Analysis Program/pressure_data.py", line 175, in print_data_range_console
text= str(format(float, '10.2f'))).grid(row=self.r_count,column=self.c_count)
TypeError: unsupported format string passed to type.__format__

I know it has to do with line 12 below but I am confused at this point

My output should be barometric pressue in the format of 1028.95 in one column and temp in the second column

def print_data_range_console(self):
new_win = tkinter.Toplevel(self.window)
label = tkinter.Label(new_win, text="Data Print")
#display_data_win = tkinter.Tk
#self.DisplayDataWin = display_data_win()
#self.display_win_open = True
"""Prints the given data selction to the console"""
print(" ".join(self.window.radio_var.get().split()))
for i in self.get_data_range():
self.DisplayWin.dd_win.data_lbl = tk.Label(self.get_data_range,\
font=('Helvetica',10), bg='white',\
text= str(format(float, '10.2f'))).grid(row=self.r_count,column=self.c_count)
self.col_count = self.c_count + 1
if self.col_count == 6:
self.col_count = 1
self.row_count = self.r_count + 1
print(" ".join(str(x) for x in i[1:]))

In: Computer Science

CIT 149 JAVA 1 programming question. The Assignment This program will display a menu to the...

CIT 149 JAVA 1 programming question.

The Assignment

This program will display a menu to the user from which they can choose an option to find the area of a rectangle, the area of a triangle, or to quit.
The user will make the selection and will be prompted to enter the height and width, or the base and height, depending upon which selection they made. The program will then calculate the appropriate area and display the results.
This program will be in two classes, each in a separate file. One will contain the main method and the other will contain instance variables and methods which make up the program.

? Specifications

There are several ways in which this program could be written. However, in order to grade for following specifications and to have a clear path to a solution, it is required that you write your program using the specifications below.

  • Use two separate files with a single class in each one.
    Name the first file (and class) Area. This is the one that will have all of the methods other than the main method. Name the second file AreaRun. This file will contain the class that has the main method and the logic which controls the program.

The Instance Variables

  • In the class called Area, you will need to create the following instance variables. Each of these Variables will be private.
    • area
    • firstDimension
    • secondDimension

Constructing the Methods

Create the following methods:

? All of the methods below will be in the class Area.

  1. menu()

    • This method will display a menu with three options (see example above):
        1. Area of a Rectangle
        1. Area of a Triangle
        1. Quit
    • This method will return the user’s selection from the menu (int of 1, 2, or 3).
    • This method will contain a loop which will hold the user until a valid selection is made (see menu example above).
    • This method does not have parameters.
  2. setFirstDimension() (Mutator)

    • This method will accept one argument which will be a double.
    • This method will set the value of the instance variable called firstDimension in the Area class.
    • This method will contain a test of the argument coming in, to see that it is > 0. If it is less than zero, a message will be displayed and the program will end (see example above).
  3. setSecondDimension() (Mutator)

    • This method will accept one argument which will be a double and will set the instance variable secondDimension in the Area class.
      • This method will contain a test of the argument coming in, to see that it is > 0. If it is less than zero, a message will be displayed and the program will end (see example above).
    • This method will not return a value.
  4. areaOfRectangle()

    • This method will be a void method and does not have parameters. It will simply calculate the area of a rectangle:
      • area = firstDimension * secondDimension
      • Use the same variable names as given above.
  5. areaOfTriangle()

    • This method will be a void method and does not have parameters. It will simply calculate the area of a rectangle:
    • area = (firstDimension * secondDimension) / 2
    • Use the same variable names as given above.
  6. displayOutput()

    • This method will has three parameters: the menu selection (1 or 2), the firstDimension value, and the secondDimension value.
    • This method will display the first and second dimensions, and the calculated area of the rectangle or triangle.
    • Use if_ and else statements to test the menu selection variable passed to this method to see if the user selected the rectangle or triangle. Then make the output conform to the output specifications below.

In: Computer Science

Use Google to search for articles discussing the built-in security features of at least two web...

Use Google to search for articles discussing the built-in security features of at least two web browsers. Submit your findings in a brief 250 word essay.

In: Computer Science

Selection sort on fstream data C++: Sort the given student information data inside a text file...

Selection sort on fstream data C++:

Sort the given student information data inside a text file

The format of the student data inside the text file is:

Student Number, Surname, First Name, Middle Name, Birthday, Course, Year, School Year

(The list can be updated over time so there is no limit for the size of the data)

But I need to automatically sort the given the data in ascending alphabetical order based on their surnames when displaying the list. I don't know how, please help me. Thank you :)

In: Computer Science

// staff should be coming in to // campus, or staying at home. Only part of...

// staff should be coming in to
// campus, or staying at home. Only part of the code is here.
// It bases the decision based on a points system by asking the
// user a set of questions and keeping track of how many times
// it gets a yes response back.
//
// The code implements policy by assigning a weight to each of the
// categories of symptoms/risk factors
// 1) Mild Symptoms (1pt each)
// 2) Severe Symptoms (2pt each)
// 3) Recent exposure (3pt each)
// 4) Risk factors (3pt each)
//
// This file implements only the checks FOR ( 1 MILD)  symptoms.
//
// There are 5 errors in this code.
//
// ~-~-~- ~-~-~-~-~ ~-~-~-~-~ ~-~-~-~-~ ~-~-~-~-~ ~-~-~-~-~ ~-~-~-~-~ ~-~-~-~-~|

import java.util.Scanner;

public class Fragment1 {

   public static final int MILD_SYMPTOMS = 1;

   // This method gets the next line of input from the scanner and
   // Checks to see if it is "yes" (in either upper or lower case)
   // If it is, it returns the number provided as the second argument
   // else, it returns 0.
   public static int checkAndAdd(Scanner input, int score){
  
String answer = input.nextLine();
if (answer.equalsIgnoreCase("yes")){
   return 0;
} else {
   return score;
}

   }

   // This method asks the user about a list of symptoms and uses
   // the checkAndAdd method to check the answers.
   // Tt sums up a score based on MILD_SYMPTOMS for each yes answer
   // and returns the total.
   public static int checkMildSymptoms(String name, Scanner input) {
int score = 0;

System.out.println(name+ ", do you have chills? (yes/no)");
score--;

System.out.println(name+ ", do you have diarrhea? (yes/no)");
score += checkAndAdd(input, MILD_SYMPTOMS);

System.out.println(name+ ", do you have sore throat? (yes/no)");
score += checkAndAdd(input, MILD_SYMPTOMS)

System.out.println{name+ ", do you have body aches? (yes/no)");
score += checkAndAdd(input, MILD_SYMPTOMS);

System.out.println(name+ ", do you have headache? (yes/no)");
score += check&Add(input, MILD_SYMPTOMS);

return score;
   }
  

   public static void main(String[] args) {
int totalScore = 0; // Tabulates the likelihood of infection
int totalRisk = 0; // Tabulates the high risk categories
String name=""; // Stores the name so we can be friendly

// Setup the scanner so we can prompt the user for answers
Scanner input = new Scanner(System.in);

System.out.println("Your total score is "+
   checkMildSymptoms(name,input)
   + " points");

   }

}

In: Computer Science

1. Customer Debt to Income Ratio (DTI) Annual Income Credit Score Extend Credit? Alice A. Hall...

1.

Customer Debt to Income Ratio (DTI) Annual Income Credit Score Extend Credit?
Alice A. Hall 0.49 $50,325.00 4.1
Bruce A. Farrell 0.18 $58,113.00 1.4
Kathleen U. Lucas 0.22 $63,241.00 1.7
Amy O. Norman 0.48 $14,347.00 1.1
Ronnie T. Atkins 0.33 $11,698.00 3.6
Martha O. Monroe 0.03 $28,112.00 3
Lynn O. Robertson 0.51 $108,420.00 3.3
Jose Y. Sykes 0.32 $88,224.00 1.1
Robert E. Reid 0.05 $39,103.00 1.4
Pauline H. Chandler 0.31 $34,964.00 3.1
Stephen I. Finch 0.43 $40,079.00 2.5
Peggy O. Hobbs 0.11 $99,100.00 4.8
Donna D. Adkins 0.29 $97,847.00 1.4
Doris I. Kinney 0.29 $40,437.00 2.3
Ben H. Whitaker 0.39 $129,588.00 2.6
Kristin L. Alexander 0.31 $69,515.00 4.8
Ryan O. Conner 0.47 $42,391.00 3.6
Tracey A. Waters 0.05 $52,559.00 4.9
Mark E. Becker 0.01 $33,307.00 2.5
Louis O. Rollins 0.38 $18,664.00 1
Criteria
DTI 0.3
Annual Income $        37,000
Credit Score 4

2. Create a formula that will return "Extend Credit" or "No Credit" in column F. In order to be receive credit, the customers must have DTI that is lower than .30 (30%) and annual income of at least $37,000 or have a credit score higher than 4.0

Sales Sales %
0 >= Your Sales < 5000 $          -   0.00%
5000 >= Your Sales < 10000 $   5,000 2.00%
Your Sales > = 10000 $ 10,000 4.00%
Sales Bonus $
$6,000.00

Enter an IF statement in G4 that will return the appropriate bonus for the sales recorded in F4. The actual bonus rate depend on the amount sold. The table B2:D5 show the bonus rate for different sales levels. This assignment will require a statement with multiple if's.

Please mention the excel formula used here.

In: Computer Science

Prove by construction that the language An = { ai | i is a multiple of...

Prove by construction that the language An = { ai | i is a multiple of n } is regular.

In other words the language An contains all strings composed of the letter a some multiple of n times

In: Computer Science

what sequence of numbers would be printed if the following function were executed with the value...

what sequence of numbers would be printed if the following function were executed with the value of N being 0?

def xxx (N):
print (N)
if (N < 5):
xxx (N + 2)
print (N)
  

In: Computer Science

Assume that you are an IT Security Manager who needs to develop access control policies for...

Assume that you are an IT Security Manager who needs to develop access control policies for the following areas: networking, server administration, database administration, and physical security. Choose one area and develop five actual policies that you could provide your employees. Please explain your choices and why these policies are important.Assume that you are an IT Security Manager who needs to develop access control policies for the following areas: networking, server administration, database administration, and physical security. Choose one area and develop five actual policies that you could provide your employees. Please explain your choices and why these policies are important.

In: Computer Science

REVIEW: KNOWLEDGE MANAGEMENT AND KNOWLEDGE MANAGEMENT SYSTEMS: CONCEPTUAL FOUNDATIONS AND RESEARCH ISSUES Explain the following in...

REVIEW: KNOWLEDGE MANAGEMENT AND KNOWLEDGE MANAGEMENT SYSTEMS: CONCEPTUAL FOUNDATIONS AND RESEARCH ISSUES

Explain the following in summary;

1 a) Knowledge Storage and Retrieval and related research issues

b) Knowledge Transfer and related research issues

c) Knowledge Application and related research issues

In: Computer Science

Describe these 4 medium-size security tools.( Wireshark, nmap, Snort, SQLMap)

Describe these 4 medium-size security tools.( Wireshark, nmap, Snort, SQLMap)

In: Computer Science

PHP Review For the Programming part: 1. Where (Which directory) you store the database connecting information?...

PHP

Review

For the Programming part:

1. Where (Which directory) you store the database connecting information? parallel to htdocs folder why? no one can access except the admin

2. difference between GET and POST methods

3. Include multiple files: include, include_once, require, require_once

4. what is a sticky form?

In: Computer Science

REVIEW: KNOWLEDGE MANAGEMENT AND KNOWLEDGE MANAGEMENT SYSTEMS: CONCEPTUAL FOUNDATIONS AND RESEARCH ISSUES Explain the following in...

REVIEW: KNOWLEDGE MANAGEMENT AND KNOWLEDGE MANAGEMENT SYSTEMS: CONCEPTUAL FOUNDATIONS AND RESEARCH ISSUES

Explain the following in summary;

1 a) Taxonomies of Knowledge

b) Knowledge Management Systems

c) Knowledge Creation and related research issues

In: Computer Science