CORAL LANGUAGE ONLY
Write a function DrivingCost with parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type float.
Ex: If the function is called with 50 20.0 3.1599, the function returns 7.89975.
Define that function in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both floats). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your DrivingCost function three times.
Ex: If the input is 20.0 3.1599, the output is:
1.57995 7.89975 63.198
Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. In the DrivingCost function, use the variables in the following order to calculate the cost: drivenMiles, milesPerGallon, dollarsPerGallon.
In: Computer Science
Project 7-6: Sales Tax Calculator
Create a program that uses a separate module to calculate sales tax and total after tax.
Create a c++ program using console.h and console.cpp files that uses a separate module to calculate sales tax and total after tax.
Console
Sales Tax Calculator
ENTER ITEMS (ENTER 0 TO END)
Cost of item: 35.99
Cost of item: 27.50
Cost of item: 19.59
Cost of item: 0
Total: 83.08
Sales tax: 4.98
Total after tax: 88.06
Again? (y/n): y
ENTER ITEMS (ENTER 0 TO END)
Cost of item: 152.50
Cost of item: 59.80
Cost of item: 0
Total: 212.30
Sales tax: 12.74
Total after tax: 225.04
Again? (y/n): n
Thanks, bye!
Specifications
been added. • Use the implementation file for this header file to store the sales tax rate and the definitions for these two functions. These functions should round the results to two decimal places. • The output should display all monetary values with 2 decimal places. • The output should right align the numbers in the second column. This makes it easier to check whether the calculations are correct.
In: Computer Science
Answer correctly the below 25 multiple questions on Software Development Security. Please I will appreciate the Correct Answer ONLY
1. Which of the following correctly best describes an object-oriented database?
2. Fred has been told he needs to test a component of the new content management application under development to validate its data structure, logic, and boundary conditions. What type of testing should he carry out?
3. Which of the following is the best description of a component-based system development method?
4. There are many types of viruses that hackers can use to damage systems. Which of the following is not a correct description of a polymorphic virus?
5. Which of the following best describes the role of the Java Virtual Machine in the execution of Java applets?
6. What type of database software integrity service guarantees that tuples are uniquely identified by primary key values?
7. In computer programming, cohesion and coupling are used to describe modules of code. Which of the following is a favorable combination of cohesion and coupling?
8. Which of the following statements does not correctly describe SOAP and Remote Procedure Calls?
9. Which of the following is a correct description of the pros and cons associated with third-generation programming languages?
10. It can be very challenging for programmers to know what types of security should be built into the software that they create. The amount of vulnerabilities, threats, and risks involved with software development can seem endless. Which of the following describes the best first step for developers to take to identify the security controls that should be coded into a software project?
11. Mary is creating malicious code that will steal a user's cookies by modifying the original client-side Java script. What type of cross-site scripting vulnerability is she exploiting?
12. Of the following steps that describe the development of a botnet, which best describes the step that comes first?
13. Which of the following antimalware detection methods is the most recent to the industry and monitors suspicious code as it executes within the operating system?
14. Which of the following describes object-oriented programming deferred commitment?
15. __________________ provides a machine-readable description of the specific operations provided by a specific web service. ________________ provides a method for web services to be registered by service providers and located by service consumers.
16. Sally has found out that software programmers in her company are making changes to software components and uploading them to the main software repository without following version control or documenting their changes. This is causing a lot of confusion and has caused several teams to use the older versions. Which of the following would be the best solution for this situation?
17. The approach of employing an integrated product team (IPT) for software development is designed to achieve which of the following objectives?
18. Which are the best reasons why a code versioning system (CVS) is an important part of a development infrastructure?
19. What is generally the safest, most secure way to acquire software?
20. Cross-site scripting (XSS) is an application security vulnerability usually found in web applications. What type of XSS vulnerability occurs when a victim is tricked into opening a URL programmed with a rogue script to steal sensitive information?
21. Widgets, Inc.'s software development processes are documented, and the organization is capable of producing its own standard of software processes. Which of the following Capability Maturity Model Integration levels best describes Widgets, Inc.?
In: Computer Science
For this assignment you will write a program with multiple functions that will generate and save between 100 and 10,000 (inclusive) "Shakespearian" insults. The program InsultsNetID.py is supplied as a starting point and it contains some tests that you must pass. The program loads words from three separate files: word1.txt, word2.txt and word3.txt. Each file contains 50 words or phrases. An insult is generated by choosing one word or phrase from each of the three lists of words at random, adding "Thou " to the beginning and "!" to the end. One such random insult would be:
Thou artless bat-fowling barnacle!
With this many words, you could generate 50 * 50 * 50, or 125,000 possible unique insults - more than enough for anyone! Your program does not have to generate more than 10,000 unique insults and will not generate less than 100 of them for saving to a file. Your program will need to generate unique insults (no two the same) and they must be in alphabetical order before being saved in a text file. You should use Python's built in list searching and sorting functionality.
If your program is working properly it should generate an output like SampleOutput.txt. The actual insults will be different. And a file called "Insults.txt" containing all the insults will also have been created. The file will contain the user specified number of unique insults in alphabetical order. The user should be able to supply any number of insults between 100 and 10,000. Input of this number should be completely robust. If he enters something non-numeric or outside the legal range, he should be continuously re-prompted to enter a legal value.
In: Computer Science
Write around 200 words only related to what do you understand about server virtualization.
In: Computer Science
Write the Java program:
In this assignment, you will create a program implementing the functionalities of a standard queue in a class called Queue3503. You will test the functionalities of the Queue3503 class from the main() method of the Main class. In a queue, first inserted items are removed first and the last items are removed at the end (imagine a line to buy tickets at a ticket counter).
The Queue3503 class will contain:
a. An int[] data filed named elements to store the int
values in the queue.
b. An int data field named size that stores the number of
elements in the queue.
c. A no-arg constructor that creates a Queue object with default
capacity 0.
d. A constructor that takes an int argument representing the
capacity of the queue.
e. A method with signature enqueue(int v) that adds the
int element v into the queue.
f. A method with signature dequeue() that removes and
returns the first element of the
queue.
g. A method with signature empty() that returns true if
the queue is empty.
h. A method with signature getSize() that returns the size
of the queue (return type is hence
int)).
The queue class you develop should be tested using the following steps: (In other words, your program named Main will consist of the following)
a. Start your queue with an initial capacity of 8.
b. When the dequeue() method is called, an element from the queue
at the beginning of the queue must be removed.
c. The main() method in your Main class should consist of
statements to:
i. Create a queue object;
ii. Call enqueue() to insert twenty integers (taken from
the user) into the queue.
iii. After the above task is completed, include a for-loop that
will print out the contents of the queue.
d. After printing the queue filled with twenty integers,
call dequeue() repeatedly to remove the beginning element of the
queue.
e. Print the contents of the queue after removing every fifth
number.
f. For your reference, the execution of the Main program is shown
below. User inputs for populating the Queue is shown in the first
line. Next, your program outputs are shown.
*Make sure the code can run in Repl.it*
Points to think about
*Make sure the code can run in Repl.it*
Sample Run
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Initial content: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
After removing 5 elements: 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
After removing 5 elements: 11 12 13 14 15 16 17 18 19 20
After removing 5 elements: 16 17 18 19 20
In: Computer Science
what is JSON and why we use it, what the threats are and how we mitigate against them, how PHP sanitises the data, how MySQL save the data and how data gets from the server onto the web page.
In: Computer Science
You have a set of four drives configured as RAID-5.
Drive #3 has crashed, but you have the data from Drives 1, 2, and 4 as shown here:
Drive #1: 01001111 01101000 01001110 01101111
Drive #2: 01011001 01110101 01110000 00100001
Drive #3: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
Drive #4: 01001111 01111100 01000111 01101111
What is the missing data in ASCII? Explain how you retrieved the information.
In: Computer Science
In the Gui need a file in and out writter. That also takes from in file and out file. Write errors to no file found or wrong file. Clear button and Process buttons need to work.
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.io.*;
import javax.swing.*;
@SuppressWarnings("serial")
public class JFileChooserDemo extends JFrame implements
ActionListener
{
private JTextField txtInFile;
private JTextField txtOutFile;
private JButton btnInFile;
private JButton btnOutFile;
private JButton btnProcess;
private JButton btnClear;
public JFileChooserDemo()
{
Container canvas = this.getContentPane();
canvas.setLayout(new GridLayout (3,1));
canvas.add(createInputFilePanel());
canvas.add(createOutputFilePanel());
canvas.add(createButtonPanel());
this.setVisible(true);
this.setSize(800, 200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public JPanel createInputFilePanel()
{
JPanel panel = new JPanel(new
FlowLayout(FlowLayout.LEFT));
panel.add(new JLabel("In File"));
txtInFile = new JTextField(60);
panel.add(txtInFile);
btnInFile = new JButton("In File");
panel.add(btnInFile);
btnInFile.addActionListener(this);
return panel;
}
public JPanel createOutputFilePanel()
{
JPanel panel = new JPanel(new
FlowLayout(FlowLayout.LEFT));
panel.add(new JLabel("Out File"));
txtOutFile = new JTextField(58);
panel.add(txtOutFile);
btnOutFile = new JButton("Out File");
panel.add(btnOutFile);
btnOutFile.addActionListener(this);
return panel;
}
public JPanel createButtonPanel()
{
JPanel panel = new JPanel(new
FlowLayout(FlowLayout.CENTER));
btnProcess =new JButton("Process");
btnProcess.addActionListener(this);
panel.add(btnProcess);
btnClear =new JButton("Clear");
btnClear.addActionListener(this);
panel.add(btnClear);
return panel;
}
public static void main(String[] args)
{
new JFileChooserDemo();
Scanner file = null;
PrintWriter fout= null;
try {
file = new Scanner(new
File("numbers.txt"));
fout = new PrintWriter("TotalSums.txt");
while(file.hasNext())
{
@SuppressWarnings("resource")
Scanner line = new
Scanner(file.nextLine());
int totalSum = 0;
while (line.hasNext()) {
int number = line.nextInt();
totalSum += number;
fout.print(number);
if (line.hasNext())
{
fout.print("+");
}
}
fout.println("=" + totalSum);
}
}
catch
(FileNotFoundException e)
{
System.out.println("NOT FOUND");
}
finally
{
if(fout!=null)fout.close();
}
if(file!=null)file.close();
}
public void clearInput()
{
txtInFile.setText(""); txtOutFile.setText("");
}
@Override
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == btnInFile)
{
JFileChooser jfcInFile = new
JFileChooser();
if(jfcInFile.showOpenDialog(this)
!= JFileChooser.CANCEL_OPTION)
{
File inFile =
jfcInFile.getSelectedFile();
txtInFile.setText(inFile.getAbsolutePath());
}
else
{
}
}
if(e.getSource() == btnProcess)
{
File file = new
File(txtInFile.getText());
try
{
Scanner fin =
new Scanner(file);
}
catch (FileNotFoundException
e1)
{
e1.printStackTrace();
}
}
}
}
In: Computer Science
In: Computer Science
Consider the following class TestScores. All the methods have direct access to the scores array. Please type in the answers here.
|
TestScores |
|
|
Write the constructor method. It fills the array with random number from 0 -100. Find below the code to get you started.
public TestScores ()
{
Random rand = new Random();
for(int i = 0; i < SIZE ; i++)
{
scores[i] = rand.nextInt(101);
}
}
Finding the maximum value in an array. Write the method findMax. It returns the maximum value in the array.
Finding the minimum value in an array. Write the method findMin. It returns the minimum value in the array.
Write the method countScores. The method returns the number of exams where the score is greater or equal to 90. This is an example of a linear search.
Write the method called findScore that accepts one int value. The method should check if the value exists in the array and if it does it returns true. Otherwise, the method should return false.
In: Computer Science
Can I have this answer in a screenshot of the python software?
In the game of Lucky Sevens, the player rolls a pair of dice. If the dots add up to 7, the player wins $4; otherwise, the player loses $1. Suppose that, to entice the gullible, a casino tells players that there are many ways to win: (1, 6), (2, 5), and soon. A little mathematical analysis reveals that there are not enough ways to win to make the game worthwhile; however, because many people's eyes glaze over at the first mention of mathematics “wins $4”.
Your challenge is to write a program that demonstrates the futility of playing the game. Your Python program should take as input the amount of money that the player wants to put into the pot, and play the game until the pot is empty.
The program should have at least TWO functions (Input validation and Sum of the dots of user’s two dice). Like the program 1, your code should be user-friendly and able to handle all possible user input. The game should be able to allow a user to ply as many times as she/he wants.
The program should print a table as following:
Number of rolls Win or Loss Current value of the pot
1 Put $10
2 Win $14
3 Loss $11
4
## Loss $0
You lost your money after ## rolls of play.
The maximum amount of money in the pot during the playing is $##.
Do you want to play again?
At that point the player’s pot is empty (the Current value of the pot is zero), the program should display the number of rolls it took to break the player, as well as maximum amount of money in the pot during the playing.
Again, add good comments to your program.
Test your program with $5, $10 and $20.
In: Computer Science
We can install Ad-blocking software to enable our web browsers
let us visit different
websites while not viewing pop-up advertisements available on those
websites. Give
reasons in favor or against the following proposition.
"Different companies provide you with free access to those websites
because they use the advertisements as a mean of revenues. Hence
you as a user violate an implicit
social contract by installing Ad-blocking software on your
browser."
*please give me you opinion not from the internet.
In: Computer Science
java:
Sample output: Aoccdrnig to reacresh at an Elingsh uinervtisy, it deos not mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer are in the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae we do not raed ervey lteter by it slef but the wrod as a wlohe and the biran fguiers it out aynawy.
PROGRAM DESCRIPTION: In this assignment, you will read an unspecified number of lines of text from STDIN. Input is terminated with EOF (ctrl-d for keyboard input). Your only output, to STDOUT, will echo the input except that the letters of any word with more than three characters will be randomly shuffled (except for the first and last letters). Don't scramble any punctuation, and you may assume that punctuation will only occur at the end of a word. Any word will have, at most, one punctuation character. Punctuation does not count towards the length of the word. You may also assume that each word will be separated by one space and that a line will have no leading or trailing whitespace. Blank lines are allowable. You must preserve the newlines (output must have the same number of lines and the same number of words on each line as when input.) (A word, here, is defined as a sequence of alphanumeric characters delimeted by whitespace.) For this assignment you must code the shuffle algorithm as described in class, and not a library shuffle function.
Sample input:According to research at an English university, it does not matter in what order the letters in a word are, the only important thing is that the first and last letter are in the right place. The rest can be a total mess and you can still read it without a problem. This is because we do not read every letter by itself but the word as a whole and the brain figures it out anyway.
Sample run:
This is a test
This is a tset
Hello, how are you today?
Hlleo, how are you toady?
SUGGESTIONS
You may find it easiest to complete this program in stages. Begin by writing a program that echos input lines of text to output. Then add the ability (a function) to break a line of text into individual words, finally add the scrambling feature (another function) for a word.
In: Computer Science
Write a recursive method to find the smallest int in an unsorted array of numbers.
int[] findMin = { 0, 1, 1, 2, 3, 5, 8, -42, 13, 21, 34, 55, 89 };
System.out.printf("Array Min: %d\n", arrayMin(findMin, 0)
public static int arrayMin(int[] data, int position) { ??? }
everything I've tried doesn't return the -42 like it should, somehow I think I end up returning a count of the search or something like that and I'm not sure where I'm going wrong. Thanks for the help.
In: Computer Science