Answer:
Encapsulation is implemented through making variables private and providing accessor and mutator methods in a class. Encapsulation is one of four pillars of OOP other three are Inheritance, Polymorphism and Abstraction.
Explanation:
Encapsulation provides data hiding through making variables private and providing access through getter and setter or accessor and mutator in a class.
ChodeHS Exercise 4.3.5: Coin Flips
Write a program to simulate flipping 100 coins. Print out the result of every flip (either Heads or Tails).
At the end of the program, print out how many heads you flipped, how many tails you flipped, what percentage were heads, and what percentage were tails.
Answer:
public class CoinFlips extends ConsoleProgram
{
public static final int FLIPS = 100;
public void run()
{
int countH = 0;
int countT = 0;
for(int i = 0; i < 100; i++)
{
if (Randomizer.nextBoolean())
{
System.out.println("Heads");
countH += 1;
}
else
{
System.out.println("Tails");
countT += 1;
}
}
System.out.println("Heads: " + countH);
System.out.println("Tails: " + countT);
System.out.println("% Heads: " + (double) countH / FLIPS);
System.out.println("% Tails: " + (double) countT / FLIPS);
}
}
Explanation:
First define your counting variables for both heads and tails (I named them countH and countT). Set them to 0 at the start of the run.
Then use a for loop to flip the coin 100 times. In the video you should have learned about the Randomizer class so you can use the same idea to print out whether you got heads or tails.
Make sure to keep the count going using >variable name< += 1.
The printing at the end is very basic; print the statement for each: ("Heads: " + >variable name<);
For the percentages, print ("% Heads: " + (double) >variable name< / FLIPS); divided by FLIPS (not 100 or any other int because you will get the wrong value) and remember to cast them as doubles to get the correct value.
The program simulates 100 coin flips and displays the result of each flip and the resulting percentage. The program written in python 3 goes thus :
import random
#import the random module
total = 0
#initialize the total coin flips
h_count = 0
t_count = 0
#initialize variable to hold the number of heads and tails
h_t = ['h', 't']
#define the sample space
while total < 100 :
#keeps track that tosses does not exceed 100
toss = random.sample(h_t, 1)
#variable to hold the outcome of each coin toss
if toss[0] == 'h':
#heck if toss is head
h_count+=1
Increase count of heads. owee
print(toss[0], end=' ')
#display the sample selected
else:
#if not head, then it's tail
t_count+=1
#increase count yv
print(toss[0], end=' ')
total+=1
#
print('head counts : ', h_count, 'percentage : ', round(h_count/100, 2),'%')
print('tail counts : ', t_count, 'percentage : ', round(t_count/100, 2), '%')
# display result.
A sample run of the program is attached
Learn more: https://brainly.com/question/18581972
In a program a menu shows a list of?
Answer:
implemented instructions
If you fail a course as a MAIN (residency) course, you can repeat that course as either a MAIN (residency) or an online (IG or IIG) course.
A. True
B. False
ben works as a database designer for abc inc. He is designing a database that will keep track of all watches manufactured be each manufacturer. Each manufacturer produces a range of watches. Ben wants the database to be normalized. How many tables should he include in the database?
Since ben works as a database designer for abc inc., the numbers of tables that he include in the database is between 3- 5.
What is data table in database?All of the data in a database is stored in tables, which are database objects. Data is logically arranged in tables using a row-and-column layout akin to a spreadsheet. Each column denotes a record field, and each row denotes a distinct record.
Therefore, one can say that database management system (or DBMS) is just a computerized data-keeping system. Users of the system are provided with the ability to carry out a variety of actions on such a system for either managing the database structure itself or manipulating the data in the database and thus 3-5 is ok.
Learn more about database from
https://brainly.com/question/518894
#SPJ1
although owns android and manages the store for apps, it allows any manufacturer to use and modify this operating system for their devices.
Yes, Go ogle does allow any manufacturer to use and modify Android for their devices.
What is modify?
Modify is a term used to describe the process of making changes or adjustments to something. It can be used in a variety of contexts, from editing a text document to customizing a car. Modifying an object or idea involves altering its form or content, taking into account the context in which it is being used. This could mean making adjustments to the size, shape, colour, texture, or other physical attributes of an object, as well as to its content. Modifying can also involve adding or removing features and introducing new ideas or concepts. In the digital world, modifications are often done through software, where elements of a program can be modified to change the way it looks or works. Modifying is a very important process in many aspects of society, as it allows us to tailor products and services to our needs and preferences.
They can customize Android to create a unique user experience, but must still adhere to the core Android compatibility requirements. Go ogle also provides tools to help manufacturers efficiently customize Android to their devices, as well as other resources such as online support, technical documentation, and training.
To learn more about modify
https://brainly.com/question/28424458
#SPJ4
Identify the following verb by number and person by checking on the appropriate boxes.
SHE WANTS!!
second person
singular
plural
same form for both singular and plural
third person
first person PLEASE HELP!!!!!! LAUNGUAGE ARTS
Answer:
Singular and third person
Explanation:
Second person: this answer is not correct as second person refers to pronouns such as “you, yourself” like in a recipe.
Singular: this is correct as a singular verb is when there is only one subject. You can also tell it’s a singular verb as the present tense ends with a “s”.
Plural: this is not plural because there is only one subject. Plus the present tense of the verb ends with an s so it’s not a plural verb. Plural verb’s present tense never ends with an s.
Third person: this is correct because the subject of the sentence is someone else. Third person pronouns include: “her, she, he, him, they, then” basically, third person is when you talk about someone else.
First person: this answer is not correct because first person refers to one’s self. So first person pronouns are: “I, me, myself”
Write a program that calculates the cost of an auto insurance policy. The program prompts the user to enter the age of the driver and the number of accidents the driver has been involved in. The program should adhere to these additional requirements:
- If the driver has more than 2 accidents and is less than the age of 25, deny insurance and in lieu of policy amount, print message: Insurance Denied.
- If the driver has more than 3 accidents, deny insurance and in lieu of policy amount, print message: Insurance Denied.
- Include a base charge of $500 dollars for all drivers
- If a driver has 3 accidents, include a surcharge of $600
- If a driver has 2 accidents, include a surcharge of $400
- If a driver has 1 accident, include a surcharge of $200
- If a driver is less than the age of 25, include an age fee of $100
- The total of the policy amount should include the base, any surcharge, and any age fee
- Use a Boolean variable for the purpose of indicating a driver is insurable
- Use at least one logical operator
- Use at least one if - elif block
- Outputs should display currency format with $ signs and commas for thousands
Here's a Python program that calculates the cost of an auto insurance policy based on the age of the driver and the number of accidents they've been involved in.
# Program to calculate auto insurance policy cost
# Prompt user for driver's age and number of accidents
age = int(input("Enter driver's age: "))
accidents = int(input("Enter the number of accidents the driver has been involved in: "))
# Initialize base charge and insurable variable
base_charge = 500
insurable = True
# Check conditions for denying insurance
if accidents > 2 and age < 25:
insurable = False
print("Insurance Denied")
elif accidents > 3:
insurable = False
print("Insurance Denied")
# Calculate surcharge based on the number of accidents
if accidents == 3:
surcharge = 600
elif accidents == 2:
surcharge = 400
elif accidents == 1:
surcharge = 200
else:
surcharge = 0
# Calculate age fee if driver is less than 25 years old
if age < 25:
age_fee = 100
else:
age_fee = 0
# Calculate total policy amount
policy_amount = base_charge + surcharge + age_fee
# Display the policy amount in currency format
print("Policy Amount: ${:,.2f}".format(policy_amount))
This program prompts the user to enter the driver's age and the number of accidents they've been involved in. It then checks the conditions for denying insurance based on the number of accidents and the driver's age. If the driver is insurable, it calculates the surcharge and age fee based on the number of accidents and age.
The total policy amount is calculated by adding the base charge, surcharge, and age fee. Finally, the program displays the policy amount in currency format with dollar signs and commas for thousands. The program uses logical operators (such as and), if-elif blocks, and a boolean variable (insurable) to meet the requirements.
For more question on Python visit:
https://brainly.com/question/26497128
#SPJ8
The epa requires spray guns used in the automotive refinishing process to have transfer efficiency of at least
The epa requires spray guns used in the automotive refinishing process to have transfer efficiency of at least 65 percent transfer efficiency.
What is the transfer efficiency
EPA lacks transfer efficiency requirement for auto refinishing spray guns. The EPA regulates auto refinishing emissions and impact with rules. NESHAP regulates paint stripping and coating operations for air pollutants.
This rule limits VOCs and HAPs emissions in automotive refinishing. When it comes to reducing overspray and minimizing wasted paint or coating material, transfer efficiency is crucial. "More efficiency, less waste with higher transfer rate."
Learn more about transfer efficiency from
https://brainly.com/question/29355652
#SPJ1
What year was html released?
2007 because I said so
Answer:
1999
Explanation:
Please rewrite and correct the following sentences:
1. Their dog ran away last night, and now their looking for him.
2. The company lost there biggest client last year.
3. Who is you going to the party with tonight?
4. The museums is open on Saturdays from 10am to 5pm.
5. Neither the boys or their father have any idea where the car keys is.
1.Their dog ran away last night, and now they are looking for him.
2. Their company lost their biggest client last year.
3. With whom you are going to the party with tonight?
4. The museums are open on saturdays from 10 am to pm.
5. Fathers or Boys no one knows where the car keys are?
Thus, English has three tenses: past, present, and future. When writing about the past, we employ the past tense.
When writing about facts, opinions, or regular occurrences, we employ the present tense. To write about upcoming events, we utilize the future tense. Each of those tenses has additional characteristics, but we won't cover them in this session.
It's crucial to maintain the same tense throughout a writing endeavor after you've decided on one. To communicate yourself clearly, you may need to switch up the tense from time to time.
Thus, English has three tenses: past, present, and future. When writing about the past, we employ the past tense.
Learn more about Tenses, refer to the link:
https://brainly.com/question/29757932
#SPJ1
我对汉语的兴趣 làm đoạn văn theo đề trên
Answer:
which language is this
Explanation:
Chinese or Korea
How does a computer go through technical stages when booting up and navigating to the sample website? Answer the question using Wireshark screenshots.
When a computer is turned on, it goes through several technical stages before it can navigate to a sample website. The following are the basic steps involved in booting up a computer and accessing a website:
How to explain the informationPower On Self Test (POST): When a computer is turned on, it undergoes a Power On Self Test (POST) process, which checks the hardware components such as RAM, hard drive, CPU, and other peripherals to ensure they are functioning properly.
Basic Input/Output System (BIOS) startup: Once the POST process is complete, the BIOS program stored in a chip on the motherboard is loaded. The BIOS program initializes the hardware components and prepares the system for booting.
Boot Loader: After the BIOS startup is complete, the boot loader program is loaded. This program is responsible for loading the operating system into the computer's memory.
Operating System (OS) startup: Once the boot loader program has loaded the operating system, the OS startup process begins. During this process, the OS initializes the hardware, loads device drivers, and starts system services.
Web browser launch: After the OS startup is complete, the user can launch a web browser. The web browser program is loaded into the memory, and the user can navigate to a sample website.
DNS Lookup: When the user types in the website address, the computer performs a Domain Name System (DNS) lookup to translate the website name into an IP address.
HTTP Request: After the IP address is obtained, the web browser sends an HTTP request to the web server that hosts the website.
Website content delivery: Once the web server receives the HTTP request, it sends back the website content to the web browser, and the website is displayed on the user's screen.
These are the basic technical stages involved in booting up a computer and navigating to a sample website.
Learn more about computer on;
https://brainly.com/question/24540334
#SPJ1
c) Based on your own experiences, what are some symbols (e.g., letters of the alphabet) people use to communicate?
Based on my own experience, some symbols people use to communicate and they are:
Emojis/emoticonsGifshand gesturesWhat do people use to communicate?Individuals utilize composed images such as letters, numbers, and accentuation marks to communicate through composing.
For occasion, letters of the letter set are utilized to make words, sentences, and sections in composed communication. Individuals moreover utilize images such as emojis and emoticons in computerized communication to communicate feelings, expressions, and responses.
Learn more about communication from
https://brainly.com/question/28153246
#SPJ1
CORRECT ANSWER GETS BRAINLIEST. HELP ASAP
What is the computer toolbar used for?
Groups similar icons together
Holds frequently used icons
Organizes files
Sorts files alphabetically
Answer:
holds frequently used icons
Answer:
gives you quick access to certain apps
Assume the variable s is a String and index is an int. Write an if-else statement that assigns 100 to index if the value of s would come between "mortgage" and "mortuary" in the dictionary. Otherwise, assign 0 to index.
Using the knowledge in computational language in python it is possible to write a code that Assume the variable s is a String and index is an int.
Writting the code:Assume the variable s is a String
and index is an int
an if-else statement that assigns 100 to index
if the value of s would come between "mortgage" and "mortuary" in the dictionary
Otherwise, assign 0 to index
is
if(s.compareTo("mortgage")>0 && s.compareTo("mortuary")<0)
{
index = 100;
}
else
{
index = 0;
}
See more about JAVA at brainly.com/question/12975450
#SPJ1
Which line of code will have the following output? Select two options.
print("The cat has kittens."
print(The cat has kittens.)
print "The cat has kittens."
print('The cat has kittens.'),
Note that the line of Code that will have the following output "The cat has kittens." are:
print("The cat has kittens.") (Option A)print('The cat has kittens.') (Option B).What is a line of Code?Source lines of code, often known as lines of code, is a software metric that counts the number of lines in the text of a computer program's source code to determine the size of the program.
A line of code (LOC) is any text line in a program that is not a remark or blank line, as well as header lines, regardless of the amount of statements or fragments of statements on the line. LOC clearly includes all lines including variable declarations, as well as executable and non-executable statements.
Learn more about Line of Code:
https://brainly.com/question/18844544
#SPJ1
What applications would you pin to your taskbar, why?
Answer:
The basics: microsoft edge, files, prbly word doc because I`m writing all the time
Other stuff would be spo.tify because i listen to music often and mine.craft
Which of the following expressions could be used to perform a case-insensitive comparison of two String objects named str1 and str2? A) str1 || str2 B) str1.equalsignoreCase(str2) C) str1 != str2 D) str1.equalsinsensitive(str2)
Note that the expressions could be used to perform a case-insensitive comparison of two String objects named str1 and str2 is: (Option B)
str1.equalsIgnoreCase(str2) is the correct expression to perform a case-insensitive comparison of two String objects named str1 and str2.
The equalsIgnoreCase() method is used to compare two String objects irrespective of their case. It returns true if the two strings are equal regardless of case, and false otherwise.
Option A) str1 || str2 is not a valid expression to perform a case-insensitive comparison of two String objects. The || operator is used for logical OR operations and cannot be used for String comparison.
Option C) str1 != str2 is used to compare two String objects for inequality. This expression does not take into account the case of the strings being compared.
Option D) str1.equalsinsensitive(str2) is not a valid method to compare two String objects. The equals() method is used for comparing two String objects, but it is case-sensitive. The equalsinsensitive() method is not a standard String method in Java.
Learn more about String objects at:
https://brainly.com/question/30746133
#SPJ1
based on the functionality we can classify Ai in to four
Answer:
1. Narrow AI: This type of AI is designed to perform specific tasks and focuses on a single object or area. It is used in the development of applications such as voice recognition, facial recognition, natural language processing, and robotics.
2. Weak AI: This type of AI is used in simple tasks that require logic and decision making. It can be used to guide search engines, play simple board games, and identify items in images.
3. General AI: This type of AI is designed to understand a variety of tasks and is used in fields such as cognitive science and artificial intelligence. It is able to understand and respond to natural language, vision, and environment.
4. Strong AI: This type of AI is designed to outperform humans in all kinds of challenging tasks. It is used in fields such as robotics, game playing, machine learning, and automated reasoning. It can be used to create autonomous vehicles and robots.
An entity can be said to have __ when it can be wronged or has feelings of some sort
PLEASE HELP!!!
Can a 775 socket be used for a i7 10700k?
What is characteristic of the Computer?
Answer: Speed, a computer works with much higher speed.
Answer:
storage to store the data and files
Create a PetStore class, a Dog class, and Cat class. Once instantiated, a PetStore should be able to take in and give out pets. The store's method for receiving pets should be called receive. This method should take a single pet object (either a Dog or Cat instance) and should add it to the store's inventory of pets. The store's method for giving out a pet should be called sell and can take no arguments. The method returns a pet when called.
Answer:
thanks to the great place
Explanation:
hottest year in hindi history and happiness and the world is not a big deal to me because I think it's a good thing for a woman who has been a good friend of yours and happiness and be happy with examples
data is information, information is Data, comparison of both
Answer:
"Data is raw, unorganized facts that need to be processed. Data can be something simple and seemingly random and useless until it is organized. When data is processed, organized, structured or presented in a given context so as to make it useful, it is called information. Each student's test score is one piece of data. "
Data is defined as facts or figures, or information that's stored in or used by a computer. An example of data is information collected for a research paper. An example of data is an email.
Hope this Helps
Mark Brainiest
Read the following statements and select the
conditional statements. Check all that apply.
If my car starts, I can drive to work
It is inconvenient when the car does not start.
If my car does not start, I will ride the bus to
work
I purchased this car used, and it is not
reliable
Answer:
if my car does not start, i will ride the bus to work
if my car starts, i can drive to work
Explanation:
Imani needs to copy text from one document into another document. She needs the pasted text to retain its original appearance. When she pastes the text, she should use which of the following settings?
Keep Text Only
Use Destination Theme
Merge Formatting
Keep Source Formatting
Answer:
Keep Text Only
Explanation:
Because why would it be any of the other ones so it would be that
Imani must transfer text from one paper to another. She ought to preserve the formatting from the original content when she pastes it. Hence, option D is correct.
What is a Document?A file produced by a software program is a computer document. Originally used to describe only word processing documents, the term "document" is now used to describe all saved files. Text, photos, music, video, and other sorts of data can all be found in documents.
An icon and a filename are used to identify documents. The filename gives the file a specific name, whereas the icon depicts the file type visually. The majority of filenames for documents also contain a file extension, which indicates the file type of the document. For instance, a Photoshop document might have a.PSD file extension, whereas a Microsoft Word document would have a.DOCX file extension.
To get more information about Document :
https://brainly.com/question/2901657
#SPJ6
In order to protect your computer from the newest virues which of the following should you do after you installed virus scan software
In order to protect your computer from the newest viruses, you should update the antivirus software and virus definition on a regular basis.
What is a virus?A virus can be defined as a malicious software program that moves through computer networks and the operating systems (OS) installed on a computer (host), specifically by attaching themselves to different software programs, links and databases.
This ultimately implies that, you should update the antivirus software and virus definition on a regular basis, so as to protect your computer from the newest viruses.
Read more on a virus here: brainly.com/question/26128220
#SPJ1
1. Design a DC power supply for the Fan which have a rating of 12V/1A
To design a DC power supply for a fan with a rating of 12V/1A, you would need to follow these steps:
1. Determine the power requirements: The fan has a rating of 12V/1A, which means it requires a voltage of 12V and a current of 1A to operate.
2. Choose a transformer: Start by selecting a transformer that can provide the desired output voltage of 12V. Look for a transformer with a suitable secondary voltage rating of 12V.
3. Select a rectifier: To convert the AC voltage from the transformer to DC voltage, you need a rectifier. A commonly used rectifier is a bridge rectifier, which converts AC to pulsating DC.
4. Add a smoothing capacitor: Connect a smoothing capacitor across the output of the rectifier to reduce the ripple voltage and obtain a more stable DC output.
5. Regulate the voltage: If necessary, add a voltage regulator to ensure a constant output voltage of 12V. A popular choice is a linear voltage regulator such as the LM7812, which regulates the voltage to a fixed 12V.
6. Include current limiting: To prevent excessive current draw and protect the fan, you can add a current-limiting circuit using a resistor or a current-limiting IC.
7. Assemble the circuit: Connect the transformer, rectifier, smoothing capacitor, voltage regulator, and current-limiting circuitry according to the chosen design.
8. Test and troubleshoot: Once the circuit is assembled, test it with appropriate load conditions to ensure it provides a stable 12V output at 1A. Troubleshoot any issues that may arise during testing.
Note: It is essential to consider safety precautions when designing and building a power supply. Ensure proper insulation, grounding, and protection against short circuits or overloads.
For more such answers on design
https://brainly.com/question/29989001
#SPJ8
Zoom Vacuum, a family-owned manufacturer of high-end vacuums, has grown exponentially over the last few years. However, the company is having difficulty preparing for future growth. The only information system used at Zoom is an antiquated accounting system. The company has one manufacturing plant located in Iowa; and three warehouses, in Iowa, New Jersey, and Nevada. The Zoom sales force is national, and Zoom purchases about 25 percent of its vacuum parts and materials from a single overseas supplier. You have been hired to recommend the information systems Zoom should implement in order to maintain their competitive edge. However, there is not enough money for a full-blown, cross-functional enterprise application, and you will need to limit the first step to a single functional area or constituency. What will you choose, and why?
Answer:
The best advice for Zoom Vacuum is to start with a Transaction Processing System(TPS). This system will process all the day to day transactions of the system. It is like a real time system where users engage with the TPS and generate, retrieve and update the data. it would be very helpful in lowering the cost of production and at the same time manufacture and produce standard quality products.
Although, TPS alone would not be sufficient enough. so Management Information System(MIS) would be needed, that can get the data from the TPS and process it to get vital information.
This MIS will bring about information regarding the sales and inventory data about the current and well as previous years.
With the combination of TPS as well as MIS is a minimum requirement for a Zoom Vacuum to become successful in the market.
Explanation:
Solution
When we look at the description of the Zoom Vacuum manufacturing company closely, we see that the business is currently a small scale business which is trying to become a small to mid scale business. This claim is supported by the fact that there is only one manufacturing plant and three warehouses. And here, we also need to have the knowledge of the fact that small business major aim is to keep the cost low and satisfy the customers by making good products. So we need to suggest what information system is best suited for small scale business enterprises.
The best recommendation would be to start with a Transaction Processing System(TPS). This system will process all the day to day transactions of the system. It is like a real time system where users interact with the TPS and generate, retrieve and modify the data. This TPS would be very helpful in lowering the cost of production and at the same time manufacture and produce standard quality products . Also TPS can help in communicating with other vendors.
But TPS along would not be sufficient. Also Management Information System(MIS) would be required that can get the data from the TPS and process it to get vital information. This MIS will help in generating information regarding the sales and inventory data about the current and well as previous years. Also MIS can create many types of graphical reports which help in tactical planning of the enterprise.
So a combination of TPS as well as MIS is a minimum requirement for a Zoom Vacuum to become successful in the market.
What is the purpose of the " + " in the code labeled // line 2 below ?
int sum;
int num1 = 3;
int num2 = 2;
sum = num1 + num2; // line 1
System.out.println(num1 + " + " + num2 + " = " + sum);// line 2
Answer:
To illustrate addition operation
Explanation:
Given
The above code segment
Required
Determine the purpose of "+" in label line 2
In line 2, num1 = 3 and num2 = 2 in line 3.
sum = 2 + 3 = 5 in line 4
From the given code segment, the plus sign is used as a string literal (i.e. "+").
This means that, the print statement will output: 3 + 2 = 5
The "+" is printed in between 3 and 2.
So, the purpose of the "+" is to show the function of the program and the function of the program is to illustrate an addition operation between two variables