Answer:
Explanation:
All of the following changes were made as per the comments on the code. The only missing change was the compareTo method which did not exactly state what the comparison needed to be, there is only one parameter being passed and no indication as to what it needed to be compared to so it is simply comparing the argument to the object in question (this)
public class PiggyBank implements Measurable, Comparable {
private int numNickels, numPennies, numDimes, numQuarters;
// to do; complete the constructor
public PiggyBank() {
numNickels = 0;
numPennies = 0;
numDimes = 0;
numQuarters = 0;
}
// to do; complete the constructor
public PiggyBank(int quarters, int dimes, int nickels, int pennies){
numQuarters = quarters;
numDimes = dimes;
numNickels = nickels;
numPennies = pennies;
}
// to do; it just returns 0; code it so that it returns the monetary
// amount of the piggy bank
public double getMeasure(){
double total = (numQuarters * 0.25) + (numDimes * 0.10) + (numNickels * 0.05) + (numPennies * 0.01);
return total;
}
// to do; it just returns 0; code it so that it correctly compares
public int compareTo(Object other){
if (this == other) {
return 1;
} else {
return 0;
}
}
// to do; it just returns a blank string right now
public String toString(int x){
return String.valueOf(x);
}
}
public class Data{
public static double average(Measurable[] objects){
double sum = 0;
for (Measurable obj : objects){
sum = sum + obj.getMeasure();
}
if (objects.length > 0){return sum / objects.length;}
else {return 0;}
}
}
import java.text.NumberFormat;
import java.util.Arrays;
public class TestPiggy {
public static void main(String[] args) {
PiggyBank [] banks = new PiggyBank[10];
banks[0] = new PiggyBank(5, 10, 19, 32);
banks[1] = new PiggyBank(6, 0, 2, 1);
banks[2] = new PiggyBank(0, 20, 15, 3);
banks[3] = new PiggyBank(1, 3, 99, 591);
banks[4] = new PiggyBank(0, 0, 10, 0);
banks[5] = new PiggyBank(15, 3, 0, 25);
banks[6] = new PiggyBank();
banks[7] = new PiggyBank(11, 3, 0, 1);
banks[8] = new PiggyBank(0, 0, 1, 5);
banks[9] = new PiggyBank(8, 10, 20, 100);
NumberFormat formatter = NumberFormat.getCurrencyInstance();
String moneyString = formatter.format(Data.average(banks));
System.out.println ("The average of all the piggy banks is " + moneyString);
Arrays.sort(banks);
System.out.println ("The piggy banks in sorted order, smallest to largest, are:");
for (int i = 0; i < 10; i++) System.out.println (banks[i]);
}
}
LAB: Contact list A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Assume that the list will always contain less than 20 word pairs. Ex: If the input is: 3 Joe 123-5432 Linda 983-4123 Frank 867-5309 Frank the output is: 867-5309
Answer:
The program in Python is as follows:
n = int(input(""))
numList = []
for i in range(n):
word_pair = input("")
numList.append(word_pair)
name = input("")
for i in range(n):
if name.lower() in numList[i].lower():
phone = numList[i].split(" ")
print(phone[1])
Explanation:
This gets the number of the list, n
n = int(input(""))
This initializes list
numList = []
This iterates through n
for i in range(n):
This gets each word pair
word_pair = input("")
This appends each word pair to the list
numList.append(word_pair)
This gets a name to search from the user
name = input("")
This iterates through n
for i in range(n):
If the name exists in the list
if name.lower() in numList[i].lower():
This gets the phone number associated to that name
phone = numList[i].split(" ")
This prints the phone number
print(phone[1])
what is the printed version of what you see on the computer screen
Answer:
screenshot
Explanation:
screenshot
Answer:
a image of what is on your screen on paper
Explanation:
This is a image of the screen of your computer with all images pasted out in paper form
Full meaning of PPSSPP
Answer:
Playstation Portable Simulator Suitable for Playing Portably
Explanation:
Answer:
I used to have one of these, so I know this means if we are talking about video game consoles, Playstation Portable Simulator for playing Portably.
Explanation:
-Hope this helped
You are given an array of integers, each with an unknown number of digits. You are also told the total number of digits of all the integers in the array is n. Provide an algorithm that will sort the array in O(n) time no matter how the digits are distributed among the elements in the array. (e.g. there might be one element with n digits, or n/2 elements with 2 digits, or the elements might be of all different lengths, etc. Be sure to justify in detail the run time of your algorithm.
Answer:
Explanation:
Since all of the items in the array would be integers sorting them would not be a problem regardless of the difference in integers. O(n) time would be impossible unless the array is already sorted, otherwise, the best runtime we can hope for would be such a method like the one below with a runtime of O(n^2)
static void sortingMethod(int arr[], int n)
{
int x, y, temp;
boolean swapped;
for (x = 0; x < n - 1; x++)
{
swapped = false;
for (y = 0; y < n - x - 1; y++)
{
if (arr[y] > arr[y + 1])
{
temp = arr[y];
arr[y] = arr[y + 1];
arr[y + 1] = temp;
swapped = true;
}
}
if (swapped == false)
break;
}
}
Assuming the user types the sentence
Try to be a rainbow in someone's cloud.
and then pushes the ENTER key, what will the value of ch be after the following code executes?.
char ch = 'a';
cin >> ch >> ch >> ch >> ch;
(in c++)
The value of ch will be the character entered by the user after executing the code.
What is the value of ch after executing the code?The code snippet cin >> ch >> ch >> ch >> ch; reads four characters from the user's input and assigns them to the variable ch. Since the user input is "Try to be a rainbow in someone's cloud." and the code reads four characters, the value of ch after the code executes will depend on the specific characters entered by the user.
In conclusion, without knowing the input, it is not possible to determine the exact value of ch. Therefore, the value of ch will be the character entered by the user after executing the code.
Read more about code execution
brainly.com/question/26134656
#SPJ1
What was the main subject of Ralph Nader's book, Unsafe at any Speed?
O the importance of political action committees and lobbyists
O the way non-profit organizations can affect governmental policies
O the lack of U.S. automobile manufacturing safety standards
O the way the U.S. government infringes on liberties by implementing safety policies
Answer:
the lack of U.S. automobile manufacturing safety standards
Explanation:
write c++ program to find maximum number for three variables using statement ?
Answer:
#include<iostream>
using namespace std;
int main(){
int n1, n2, n3;
cout<<"Enter any three numbers: ";
cin>>n1>>n2>>n3;
if(n1>=n2 && n1>=n3){
cout<<n1<<" is the maximum";}
else if(n2>=n1 && n2>=n3){
cout<<n2<<" is the maximum";}
else{
cout<<n3<<" is the maximum";}
return 0;
}
Explanation:
The program is written in C++ and to write this program, I assumed the three variables are integers. You can change from integer to double or float, if you wish.
This line declares n1, n2 and n3 as integers
int n1, n2, n3;
This line prompts user for three numbers
cout<<"Enter any three numbers: ";
This line gets user input for the three numbers
cin>>n1>>n2>>n3;
This if condition checks if n1 is the maximum and prints n1 as the maximum, if true
if(n1>=n2 && n1>=n3){
cout<<n1<<" is the maximum";}
This else if condition checks if n2 is the maximum and prints n2 as the maximum, if true
else if(n2>=n1 && n2>=n3){
cout<<n2<<" is the maximum";}
If the above conditions are false, then n3 is the maximum and this condition prints n3 as the maximum
else{
cout<<n3<<" is the maximum";}
return 0;
What is the difference between Information Technology and Communication Technology?
Answer:
Explanation:
information tech is technology that teaches you information, and communication tech is tech that lets you talk to family and friends and meet new people.
Answer:
The main difference between information technology and communication technology is that Information technology is a subject that is use of computers to store, retrieve, transmit and manipulate data, or information, often in the context of business or other enterpise whereas a Communication technology is the use of computers to communicate with family and friends.
The value at index position x in the first array corresponds to the value at the
same index position in the second array. Initialize the array in (a) with hardcoded random sales values. Using the arrays in (a) and (b) above, write Java
statements to determine and display the highest sales value, and the month in
which it occurred. Use the JOptionPane class to display the output.
Sure! Here's a Java code snippet that demonstrates how to find the highest sales value and its corresponding month using two arrays and display the output using the JOptionPane class:
import javax.swing.JOptionPane;
public class SalesAnalyzer {
public static void main(String[] args) {
// Array with hardcoded random sales values
double[] sales = {1500.0, 2000.0, 1800.0, 2200.0, 1900.0};
// Array with corresponding months
String[] months = {"January", "February", "March", "April", "May"};
double maxSales = sales[0];
int maxIndex = 0;
// Find the highest sales value and its index
for (int i = 1; i < sales.length; i++) {
if (sales[i] > maxSales) {
maxSales = sales[i];
maxIndex = i;
}
}
// Display the highest sales value and its corresponding month
String output = "The highest sales value is $" + maxSales +
" and it occurred in " + months[maxIndex] + ".";
JOptionPane.showMessageDialog(null, output);
}
}
Explanation:
The code defines two arrays: sales for the hardcoded random sales values and months for the corresponding months.The variables maxSales and maxIndex are initialized with the first element of the sales array.A loop is used to iterate through the sales array starting from the second element. It compares each value with the current maxSales value and updates maxSales and maxIndex if a higher value is found.After the loop, the output message is constructed using the highest sales value (maxSales) and its corresponding month from the months array (months[maxIndex]). Finally, the JOptionPane.showMessageDialog() method is used to display the output in a dialog box.When you run the program, it will display a dialog box showing the highest sales value and the month in which it occurred based on the provided arrays.
For more questions on array, click on:
https://brainly.com/question/28061186
#SPJ8
Words that when clicked on can link to another website are called:
Answer:
hyperlink
Explanation:
youwelcome:)
C:/Users/Documents/resume.docx Where is the "resume" document located in this file structure?
Answer:
"resume.docx" is located in "Documents"
Explanation:
[<drive-letter:: represents drive name>]:/Main_Directory/Sub_Directory/ETC..
The "resume" is located in the "Documents" according to the file structure.
Given the information C:/Users/Documents/resume.docx, this can be interpreted as Documents is in the Users folder and the resume can be found in the Document folder.
We can also say that the document folder was created by the user and the "resume" file is placed directly into the documents.
Based on the explanation, we can say that the "resume" is located in the "Documents" according to the file structure.
Learn more here: https://brainly.com/question/13715153
Which Chart Tool button allows you to quickly toggle the legend on and off?
Chart Styles button
Chart Filters button
Chart Elements button
Chart Font button
Answer:
The answer to this question is given below in the explanation section.
Explanation:
The correct answer to this question is:
Chart Element button
When you will insert a chart in excel, after inserting a chart in excel, when you click on the chart, then at the top right corner a button "+" will appear. This is called the Chart Elements button. By using this button, you can quickly toggle the legend on and off. By using this button you can add, remove, or change chart elements such as gridlines, title, legend, and data label, etc.
While other options are not correct because:
Chart Style button is used to change the style and color of a chart. Chart Filter button is used to filter the name and series of the chart and display them. While the chart font button is used to change the font of the chart.
Answer:
C. Chart Element Button
Explanation:
6. In terms of a career, the word benefits refers to how much vacation and salary bonuses a person gets. True False
It is false that in terms of a career, the word benefits refers to how much vacation and salary bonuses a person gets.
The term "benefits" in the context of a profession comprises a wider range of offerings supplied by a company to an employee, even if vacation and pay bonuses might be included in the benefits package.
Benefits frequently involve additional remuneration and benefits in addition to vacation time and salary increases.
Health insurance, retirement plans, paid time off, flexible work schedules, tuition reimbursement, employee assistance programmes, wellness programmes, and other benefits are a few examples of these.
The benefits package is intended to draw in new hires, keep them on board, improve job satisfaction, and support workers' health and work-life balance. Therefore, vacation time and incentive pay are just a portion of the total benefits that an employer provides.
Thus, the given statement is false.
For more details regarding career, visit:
https://brainly.com/question/8825832
#SPJ1
Select the items that can be measured.
capacity
smoothness
nationality
thickness
distance
scent
income
Answer:
distance
capacity
smoothness
thickness
al Explain the of mechanical era history of computing devices in long
The mechanical age can be defined as the time between 1450 and 1840. A lot of new technologies were developed in this era due to an explosion of interest in computation and information. Technologies like the slide ruler (an analog computer used for multiplying and dividing) were invented in this period.
Write a method to convert from Celsius to Fahrenheit using the following method header:// convers form Celsius to Fahrenheitpublic static double celsiusToFahrenheit (double celsius)The formula for the conversion is: Fahrenheit = ( 9/5) * Celsius +32
Answer:
public class Main
{
public static void main(String[] args) {
System.out.println(celsiusToFahrenheit(10));
}
public static double celsiusToFahrenheit (double celsius){
double fahrenheit = (9/5.0) * celsius + 32;
return fahrenheit;
}
}
Explanation:
Create a method named celsiusToFahrenheit that takes one parameter, celsius
Inside the method:
Convert the celcius to fahrenheit using the given formula. Note that, in the formula 9/5 is integer division. You need to convert it to the double so that the result should not be 0. One solution is converting one of the int to decimal, 9/5 → 9/5.0
Return the fahrenheit
Inside the main method:
Call the celsiusToFahrenheit() with some value and print the result
working with the tkinter(python) library
make the window you create always appear on top of other windows. You can do this with lift() or root.attributes('-topmost', ...), but this does not apply to full-screen windows. What can i do?
To make a tkinter window always appear on top of other windows, including full-screen windows, you must use the wm_attributes method with the topmost attribute set to True.
How can I make a tkinter window always appear on top of other windows?By using the wm_attributes method in tkinter and setting the topmost attribute to True, you can ensure that your tkinter window stays on top of other windows, even when they are in full-screen mode.
This attribute allows you to maintain the window's visibility and prominence regardless of the current state of other windows on your screen.
Read more about python
brainly.com/question/26497128
#SPJ1
In Coral Code Language - A half-life is the amount of time it takes for a substance or entity to fall to half its original value. Caffeine has a half-life of about 6 hours in humans. Given the caffeine amount (in mg) as input, output the caffeine level after 6, 12, and 18 hours.
Ex: If the input is 100, the output is:
After 6 hours: 50.0 mg
After 12 hours: 25.0 mg
After 18 hours: 12.5 mg
Note: A cup of coffee has about 100 mg. A soda has about 40 mg. An "energy" drink (a misnomer) has between 100 mg and 200 mg.
To calculate the caffeine level after 6, 12, and 18 hours using the half-life of 6 hours, you can use the formula:
Caffeine level = Initial caffeine amount * (0.5 ^ (time elapsed / half-life))
Here's the Coral Code to calculate the caffeine level:
function calculateCaffeineLevel(initialCaffeineAmount) {
const halfLife = 6; // Half-life of caffeine in hours
const levelAfter6Hours = initialCaffeineAmount * Math.pow(0.5, 6 / halfLife);
const levelAfter12Hours = initialCaffeineAmount * Math.pow(0.5, 12 / halfLife);
const levelAfter18Hours = initialCaffeineAmount * Math.pow(0.5, 18/ halfLife);
return {
'After 6 hours': levelAfter6Hours.toFixed(1),
'After 12 hours': levelAfter12Hours.toFixed(1),
'After 18 hours': levelAfter18Hours.toFixed(1)
};
}
// Example usage:
const initialCaffeineAmount = 100;
const caffeineLevels = calculateCaffeineLevel(initialCaffeineAmount);
console.log('After 6 hours:', caffeineLevels['After 6 hours'], 'mg');
console.log('After 12 hours:', caffeineLevels['After 12 hours'], 'mg');
console.log('After 18 hours:', caffeineLevels['After 18 hours'], 'mg');
When you run this code with an initial caffeine amount of 100 mg, it will output the caffeine levels after 6, 12, and 18 hours:
After 6 hours: 50.0 mg
After 12 hours: 25.0 mg
After 18 hours: 12.5 mg
You can replace the initialCaffeineAmount variable with any other value to calculate the caffeine levels for different initial amounts.
for similar questions on Coral Code Language.
https://brainly.com/question/31161819
#SPJ8
Select the correct answer. Why is it important to identify your audience while making a presentation? A. It helps you define the time limit and number of slides required in the presentation. B. It helps you adapt the presentation to the appropriate level and complexity. C. It helps you establish whether you require a conclusion in your presentation. D. It helps you decide how much practice you need for the presentation.
Answer:B
Explanation:
When the Credit Card Number box and the CSC box receive the focus, a transition effect should appear that slowly adds a glowing brown shadow around the boxes. The glowing brown shadow appears but without a transition effect. Return to the code8-4_debug.css file and study the code that applies a transition effect to both the input#cardBox and input#CSC objects, and the input#csc:invalid style. Correct any mistakes you find in the code. Verify that when the Credit Card Number and CSC boxes receive the focus a transition effect appears that adds the glowing brown shadow to the boxes.
Answer:
dire ako maaram hito because dire ako baltok
medyo la
6.20 LAB: Acronyms An acronym is a word formed from the initial letters of words in a set phrase. Write a program whose input is a phrase and whose output is an acronym of the input. If a word begins with a lower case letter, don't include that letter in the acronym. Assume there will be at least one upper case letter in the input. Ex: If the input is: Institute of Electrical and Electronics Engineers the output should be: IEEE
Answer:
Explanation:
The following code is written in Python. It creates a function that takes in a phrase as an argument. Then it splits the phrase into a list of words. Next, it loops through the list and adds the first letter of each word into the acronym variable if it is a capital letter. Finally, returning the acronym variable. Output can be seen in the attached picture below.
def accronymGenerator(phrase):
phrase_split = phrase.split(' ')
acronym = ""
for x in phrase_split:
if x[0].isupper() == True:
acronym += x[0]
else:
pass
return acronym
lan is working on a project report that will go through multiple rounds of
revisions. He decides to establish a file labeling system to help keep track of
the different versions. He labels the original document
ProjectReport_v1.docx. How should he label the next version of the
document?
A. ProjectReport_revised.docx
B. ProjectReport_v1_v2.docx
C. Report_v2.docx
D. ProjectReport_v2.docx
Answer:It’s D
Explanation:
APEVX
The label of the next version of the document can probably be ProjectReport_v2.docx. The correct option is D.
What is a document?A document's purpose is to enable the transmission of information from its author to its readers.
It is the author's responsibility to design the document so that the information contained within it can be interpreted correctly and efficiently. To accomplish this, the author can employ a variety of stylistic tools.
Documentation can be of two main types namely, products and processes. Product documentation describes the product under development and provides instructions on how to use it.
A document file name is the name given to a document's electronic file copy.
The file name of the document does not have to be the same as the name of the document itself. In fact, you can use the shortest possible version of the name.
As the document here is second version of the previous one, so its name should be ProjectReport_v2.docx.
Thus, the correct option is D.
For more details regarding document, visit:
https://brainly.com/question/27396650
#SPJ2
Create a CourseException class that extends Exception and whose constructor receives a String that holds a college course’s department (for example, CIS), a course number (for example, 101), and a number of credits (for example, 3). Create a Course class with the same fields and whose constructor requires values for each field. Upon construction, throw a CourseException if the department does not consist of 3 letters, if the course number does not consist of three digits between 100 and 499 inclusive, or if the credits are less than 0.5 or more than 6. The ThrowCourseException application has been provided to test your implementation. The ThrowCourseException application establishes an array of at least six Course objects with valid and invalid values and displays an appropriate message when a Course object is created successfully and when one is not.
Answer:
Explanation:
The following classes were created in Java. I created the constructors as requested so that they throw the CourseException if the variables entered do not have the correct values. The ThrowCourseException application was not provided but can easily call these classes and work as intended when creating a Course object. Due to technical difficulties, I have added the code as a txt file down below.
In this exercise we have to use the knowledge of computational language in JAVA, so we have that code is:
It can be found in the attached image.
So, to make it easier, the code in JAVA can be found below:
class Course {
private final Object CourseException = new Object();
String department;
int courseNumber;
double credits;
final int DEPT_LENGTH = 3;
final int LOW_NUM = 100;
final int HIGH_NUM = 499;
final double LOW_CREDITS = 0.5;
final double HIGH_CREDITS = 6;
public Course() throws Throwable {
throw (Throwable) CourseException;
}
See more about JAVA at brainly.com/question/2266606
when you value stored in a variable its previous value gets _________.
a) Accepted b) Overwritten c) Overlapped
Answer:
B
Explanation:
You wore more a thu friends
________ group is used to select font styles.
Answer:
The font group............. ...what is the use of router ?
Answer:
A router is a networking device that forwards data packets between computer networks. Routers perform the traffic directing functions on the Internet. Data sent through the internet, such as a web page or email, is in the form of data packets.
Explanation:
A painting company has determined that to paint 115 square feet of wall space, the task will require one gallon of paint and 8 hours of labor. The company charges $20.00 per hour for labor. Design a modular program that asks the user to enter the number of square feet of wall space to be painted and the price of paint per gallon. The program should then calculate and display the following data:
The number of gallons of paint required
The hours of labor required
The cost of the paint
The labor charges
The total cost of the paint job
Your program should contain the following modules:
Module main. Accepts user input of the wall space (in square feet) and the price of a gallon of paint. Calculates the gallons of paint needed to paint the room, the cost of the paint, the number of labor hours needed, and the cost of labor. Calls summaryPaint, passing all necessary variables.
Module summaryPaint. Accepts the gallons of paint needed, the cost of the paint, the number of labor hours needed, and the cost of labor. Calculates and displays total cost of the job and statistics shown in the Expected Output.
Expected Output
Enter wall space in square feet: 500
Enter price of paint per gallon: 25.99
Gallons of paint: 4.3478260869565215
Hours of labor: 34.78260869565217
Paint charges: $112.99999999999999
Labor charges: $695.6521739130435
Total Cost: $808.6521739130435
I have tried writing the statement in the cost of Paint method in to the main method and it works. But that does not help as I need the method to do this. I know my problem has to do with the paintNeeded variable, I am just unsure of how to fix this.
Write a program of square feet?
public class Main{
public static double paintRequired(double totalSquareFeet){
double paintNeeded = totalSquareFeet / 115;
return paintNeeded;
}
public static double costOfPaint(double paintNeeded, double costOfPaint){
double paintCost = paintNeeded * costOfPaint;
return paintCost;
}
public static void main(String[] args){
double costOfPaint = 0;
int totalSquareFeet = 0;
double paintNeeded = 0;
Scanner getUserInput = new Scanner(System.in);
System.out.println("what is the cost of the paint per gallon");
costOfPaint = getUserInput.nextDouble();
System.out.println("How many rooms do you need painted");
int rooms = getUserInput.nextInt();
for(int i = 1; i <= rooms; i++){
System.out.println("how many square feet are in room:" + i);
int roomSquareFeet = getUserInput.nextInt();
totalSquareFeet = roomSquareFeet + totalSquareFeet;
}
System.out.println("the amount of paint needed:" + paintRequired(totalSquareFeet) + "gallons");
System.out.println("the cost of the paint will be: " + costOfPaint(paintNeeded, costOfPaint));
}
}
For my costOfPaint i keep getting 0.
To learn more about square feet refers to:
https://brainly.com/question/24657062
#SPJ4
You would like to search for information about how search engines use Web crawlers. Your keywords should
be "should," "how," and "crawlers."
O True
O False
which type of network is the internet? choose the answer
Answer:
WAN or wide area network
Explanation:
The Internet is the most basic example of a WAN. It is connecting all computers together around the world.
A team member who tends to dominate the conversation and openly disagree with others would most likely come from a ______ culture
Individualistic
Collectivistic
Equal
Cooperative