Answer:
thanks for your question
Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional.
Answer:
following are the program to the given question:
Program:
x = 0#defining an integer variable that holds a value
if x < 0:#defining if that checks x less than 0
print("This number ", x, " is negative.")#print value with the message
else:#defining else block
if x > 0:#defining if that checks x value greater than 0
print(x, " is positive")#print value with message
else:#defining else block
print(x, " is 0")#print value with message
if x < 0:#defining another if that checks x less than 0
print("This number ", x, " is negative.")
elif (x > 0):#defining elif block that check x value greater than 0
print(x, " is positive")#print value with message
else:#defining else block
print(x, " is 0")#print value with message
Output:
Please find the attachment file.
Explanation:
In this code, an x variable is defined which holds a value that is "0", in the next step nested conditional statement has used that checks the x variable value and uses the print method that compares the value and prints its value with the message.
In another conditional statement, it uses if that checks x value less than 0 and print value with the negative message.
In the elif block, it checks x value that is greater than 0 and prints the value with the positive message, and in the else block it will print the message that is 0.
In PyCharm, write a program that prompts the user for their name and age. Your program should then tell the user the year they were born. Here is a sample execution of the program with the user input in bold:What is your name? AmandaHow old are you? 15Hello Amanda! You were born in 2005.
Answer:
def main():
name = input("What is your name? ")
if not name == "" or "":
age = int(input("What is your age? "))
print("Hello " + name + "! You were born in " + str(2021 - age))
main()
Explanation:
Self explanatory
According the SDLC phases, which among these activities see a substantial amount of automation initiatives?
A code generation
B release build
C application enhancement
D test case generation
E incident management
Answer:
d. test case generation
Explanation:
Testing should be automated, so that bugs and other errors can be identified without a human error and lack of concentration.
The System Development Life Cycle (SDLC) phase that has seen a substantial amount of automation is the A. code generation.
The main phases of the SDLC include the planning, analysis, design, development, testing, implementation, and maintenance phases.Using automation for the code generation will help eliminate human errors and increase efficiency.The code generation phase still requires some human input to ensure that user requirements are completely met.Thus, while automation will be useful with all the SDLC phases, substantial amount of automation initiatives have been seen with the code generation phase.
Learn more about SDLC phases at https://brainly.com/question/15074944
Which of the following is not a characteristic of Web 2.0?
a. blogs
O b. interactive comments being available on many websites
O c. mentorship programs taking place via the internet
d. social networking
Answer:
c. mentorship programs taking place via the internet
Explanation:
The World Wide Web (WWW) was created by Tim Berners-Lee in 1990, which eventually gave rise to the development of Web 2.0 in 1999.
Web 2.0 can be defined as a collection of internet software programs or applications which avails the end users the ability or opportunity to share files and resources, as well as enhance collaboration over the internet.
Basically, it's an evolution from a static worldwide web to a dynamic web that enhanced social media. Some of the examples of social media platforms (web 2.0) are You-Tube, Flickr, Go-ogle maps, Go-ogle docs, Face-book, Twit-ter, Insta-gram etc.
Some of the main characteristics of Web 2.0 are;
I. Social networking.
II. Blogging.
III. Interactive comments being available on many websites.
Also, most software applications developed for Web 2.0 avails its users the ability to synchronize with handheld or mobile devices such as smartphones.
However, mentorship programs taking place via the internet is not a characteristic of Web 2.0 but that of Web 3.0 (e-mentoring).
The option that is not a characteristic of Web 2.0 from the following is mentorship programs taking place via the internet.
What is Web 2.0?Web 2.0 speaks volumes about the Internet applications of the twenty-first millennium that have revolutionized the digital era. It is the second level of internet development.
It distinguishes the shift from static web 1.0 pages to engaging user-generated content. Web 2.0 websites have altered the way data is communicated and distributed. Web 2.0 emphasizes the following:
User-generated content, The convenience of use, andEnd-user inter-operability.Examples of Web 2.0 social media include:
Face book, Twi tter, Insta gram etcWith these social media and web 2.0 websites;
It is possible to create a personal blog,Interact with other users via comments, and Create a social network.Therefore, we can conclude that the one that is not part of the characteristics of Web 2.0 is mentorship programs taking place via the internet.
Learn more about web 2.0 here:
https://brainly.com/question/2780939
Prime numbers can be generated by an algorithm known as the Sieve of Eratosthenes. The algorithm for this procedure is presented here. Write a program called primes.js that implements this algorithm. Have the program find and display all the prime numbers up to n = 150
Answer:
Explanation:
The following code is written in Javascript and is a function called primes that takes in a single parameter as an int variable named n. An array is created and looped through checking which one is prime. If So it, changes the value to true, otherwise it changes it to false. Then it creates another array that loops through the boolArray and grabs the actual numberical value of all the prime numbers. A test case for n=150 is created and the output can be seen in the image below highlighted in red.
function primes(n) {
//Boolean Array to check which numbers from 1 to n are prime
const boolArr = new Array(n + 1);
boolArr.fill(true);
boolArr[0] = boolArr[1] = false;
for (let i = 2; i <= Math.sqrt(n); i++) {
for (let j = 2; i * j <= n; j++) {
boolArr[i * j] = false;
}
}
//New Array for Only the Prime Numbers
const primeNums = new Array();
for (let x = 0; x <= boolArr.length; x++) {
if (boolArr[x] === true) {
primeNums.push(x);
}
}
return primeNums;
}
alert(primes(150));
Gimme Shelter Roofers maintains a file of past customers, including a customer number, name, address, date of job, and price of job. It also maintains a file of estimates given for jobs not yet performed; this file contains a customer number, name, address, proposed date of job, and proposed price. Each file is in customer number order.
Required:
Design the logic that merges the two files to produce one combined file of all customers whether past or proposed with no duplicates; when a customer who has been given an estimate is also a past customer, use the proposed data.
Answer:
Hre the complete implementation of python code that reads two files and merges them together.
def merge_file(past_file_path,proposed_file_path, merged_file_path):
past_file_contents=load_file(past_file_path)
proposed_file_contents=load_file(proposed_file_path)
proposed_customer_name = []
for row in proposed_file_contents:
proposed_customer_name.append(row[1])
with open(merged_file_path,'w') as outputf:
outputf.write("Customer Number, Customer Name, Address\r\n")
for row in proposed_file_contents:
line = str(row[0]) +", " + str(row[1]) + ", " + str(row[2]) +"\r\n"
outputf.write(line)
for row in past_file_contents:
if row[1] in proposed_customer_name:
continue
else:
line = str(row[0]) + ", " + str(row[1]) + ", " + str(row[2]) + "\r\n"
outputf.write(line)
print("Files merged successfully!")
# reads the file and returns the content as 2D lists
def load_file(path):
file_contents = []
with open(path, 'r') as pastf:
for line in pastf:
cells = line.split(",")
row = []
for cell in cells:
if(cell.lower().strip()=="customer number"):
break
else:
row.append(cell.strip())
if len(row)>0:
file_contents.append(row)
return file_contents
past_file_path="F:\\Past Customer.txt"
proposed_file_path="F:\\Proposed Customer.txt"
merged_file_path="F:\\Merged File.txt"
merge_file(past_file_path,proposed_file_path,merged_file_path)
What type of address do computers use to find something on a network?
In this progress report, you will be focusing on allowing one of the four transactions listed below to be completed by the user on one of his accounts: checking or savings. You will include defensive programming and error checking to ensure your program functions like an ATM machine would. The account details for your customer are as follows:CustomerUsernamePasswordSavings AccountChecking AccountRobert Brownrbrownblue123$2500.00$35.00For this progress report, update the Progress Report 2 Raptor program that allows the account owner to complete one of the 5 functions of the ATM:1 – Deposit (adding money to the account)2 – Withdrawal (removing money from the account)3 – Balance Inquiry (check current balance)4 – Transfer Balance (transfer balance from one account to another)5 – Log Out (exits/ends the program)After a transaction is completed, the program will update the running balance and give the customer a detailed description of the transaction. A customer cannot overdraft on their account; if they try to withdraw more money than there is, a warning will be given to the customer. Also note that the ATM does not distribute or collect coins – all monetary values are in whole dollars (e.g. an integer is an acceptable variable type). Any incorrect transaction types will display an appropriate message and count as a transaction.
Answer:
Please find the complete solution in the attached file.
Explanation:
In this question, the system for both the Savings account should also be chosen, the same should be done and for checking account. Will all stay same in.
Use MPLAB to write an asemply program to multipy two numbers (11111001) and (11111001). Then save the product in file reisters 0x50 and 0x51. Return a snapshot of your code, the SFR memory view showing the register used to store the multiplication, the file register view showing the product value.
explain the reason why vector graphics are highly recommended for logo
Answer:
Currently, raster (bitmap files) and vector graphics are used in web design. But if you want to make a great logo and fully enjoy the use of it you should pick vector graphics for it in the first place. And this is why most designers opt for it.
Explanation:
Easier to re-editNo image distortionIt is perfect for detailed imagesVector drawings are scalableVector graphics look better in printWhich of the following is not a benefit provided by a stakeholder analysis document
Answer:
This is not a benefit provided by a stakeholder analysis document: You can prioritize stakeholders so you make sure to keep the most important ones happy. Explanation: ... The purpose of the document is not to prioritize stakeholders but to identify the groups.
Explanation:
hãy giúp tôi giảiiii
Answer:
fiikslid wugx uesbuluss wuz euzsbwzube
Wilh the aid of the the diagram using an algorithm to calculate table 2 of multiplication
Answer:
See attachment for algorithm (flowchart)
Explanation:
The interpretation of the question is to design a flowchart for times 2 multiplication table (see attachment for the flowchart)
The explanation:
1. Start ---> Start the algorithm
2. num = 1 ---> Initializes num to 1
3. while num [tex]\le[/tex] 12 ---> The following loop is repeated while num is less than 12
3.1 print 2 * num ----> Print the current times 2 element
3.2 num++ ---> Increment num by 1
4. Stop ---> End the algorithm
define natural language?
Answer: Natural Language is a language that is the native speech of a people. A language that has developed and evolved naturally, through use by human beings, as opposed to an invented or constructed language, as a computer programming.
Hope this helps!
three hardware priorities for a CAD workstation are a multicore processor, maximum RAM, and a high-end video card. How do each of these components meet the specific demands of this type of computer system
Answer: they meet it because CAD workstations are supposed to be equipped with high end supplies.
Explanation:
If you could design your own home, what kinds of labor-saving computer network or data communications devices would you incorporate
Answer:
Access Points, Home Server, and Virtual Assistant/IOT connected devices
Explanation:
There are three main things that should be implemented/incorporated into your design and these are Access Points, Home Server, and Virtual Assistant/IOT connected devices. Access Points for Ethernet, and HDMI should be located in various important walls near outlets. This would allow you to easily connect your devices without having to run cables around the house. A home server will allow you to easily access your data from multiple devices in your home, and if you connect it to the internet you can access that info from anywhere around the world. Lastly, would be a virtual assistant with IOT connected devices. This would allow you to control various functions of your home with your voice including lights, temperature, and locks.
Which statement regarding dialogues in multiplayer games is true?
A.
Dialogues are based only on players’ actions.
B.
Dialogues are restricted to the game’s characters.
C.
Dialogues may be between the game’s characters as well as the players.
D.
Dialogues serve the sole purpose of advancing the storyline.
E.
Dialogues are based only on events that have occurred in the game.
Game Development
Answer:
A. Dialogues are based only based on player's actions.
Explanation:
In multiplayer games, there is a feature of dialogue which makes a game interesting. These dialogues are displayed when a player acts in a certain way. The actions of the player defines the dialogues. There are various sets of dialogues which are fed into the game and they are displayed one by one when player performs actions.
As information technology has grown in sophistication, IT professionals have learned how to utilize __________ to look for hidden patterns and previously unknown relationships among data which can lead to better decision making. Multiple Choice data mining data hoarding knowledge management cloud computing
Answer:
data mining
Explanation:
Data mining can be defined as a process which typically involves extracting and analyzing data contained in large databases through the use of specialized software to generate new information.
Generally, computer database contain the records about all the data elements (objects) such as data relationships with other elements, ownership, type, size, primary keys etc. These records are stored and communicated to other data users when required or needed.
Hence, as a result of the advancement in information technology (IT), IT professionals have learned over time on how to utilize data mining as a technique to look for hidden patterns and previously unknown relationships that exists among data which is capable of leading to better decision making.
Furthermore, data mining is a process that has been in existence for a very long time and has significantly impacted workflow management, communication and other areas.
If i took my SIM card out of my phone and put it in a router then connect the router and my phone with Ethernet cable would the ping change?
Answer:
The ping will change.
Explanation:
Assuming you mean ping from device with SIM card to another host (no mater what host), the ping will change. Ping changes even on the same device because network speed and performance of all the nodes on the route changes continuously. However, if two of your devices (phone & router) are configured differently (use different routing under the hood), then it will also affect the ping.
You have a contactless magnetic stripe and chip reader by Square. What type of wireless transmission does the device use to receive encrypted data
Answer:
Near field communication (NFC)
Explanation:
Near field communication (NFC) can be defined as a short-range high radio-frequency identification (RFID) wireless communication technology that is used for the exchange of data in a simple and secure form, especially for electronic devices within a distance of about 10 centimeters.
Also, Near field communication (NFC) can be used independently or in conjunction with other wireless communication technology such as Bluetooth.
Some of the areas in which Near field communication (NFC) is used are confirmation of tickets at a concert, payment of fares for public transport systems, check-in and check-out in hotels, viewing a map, etc.
Assuming you have a contactless magnetic stripe and chip reader by Square. Thus, the type of wireless transmission that this device use to receive encrypted data is near field communication (NFC).
Question: Name the person who originally introduced the idea of patterns as a solution design concept.
Answer:
architect Christopher Alexander is the person who originally introduced the idea of patterns as a solution design concept.
The person who originally introduced the idea of patterns as a solution design concept named as Christopher Alexander who was an architect.
What is architecture?Architecture is referred to as an innovative technique or artwork based on buildings or physical structures that aims at creating cultural values for upcoming generations to understand the importance of history.
The external layout can be made to best support human existence and health by using a collection of hereditary solutions known as the "pattern language." It creates a set of helpful relationships by combining geometry and social behavior patterns.
Christopher Alexander, a British-American engineer and design theorist of Austrian heritage, is renowned for his several works on the design and construction process introduced the idea of patterns as a solution design concept.
Learn more about pattern language architecture, here:
https://brainly.com/question/4114326
#SPJ6
Write a program that defines an array of integers and a pointer to an integer. Make the pointer point to the beginning of the array. Then, fill the array with values using the pointer (Note: Do NOT use the array name.). Enhance the program by prompting the user for the values, again using the pointer, not the array name. Use pointer subscript notation to reference the values in the array.
Answer:
#include<iostream>
using namespace std;
int main()
{
int a[20],n;
int *p;
cout<<"\n enter how many values do you want to enter:";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"\n Enter the "<<i+1 <<"th value :";
cin>>*(p+i);
//reading the values into the array using pointer
}
cout<<"\n The values in the array using pointer is:\n";
for(int i=0;i<n;i++)
{
cout<<"\n (p+"<<i<<"): "<<*(p+i);
//here we can use both *(p+i) or p[i] both are pointer subscript notations
}
}
Output:
CRM Technologies Build Versus Buy Analysis and Program Management You work for a large Boston based investment firm. They are currently using an older CRM (Client Relationship Management) system. It was home grown/built in house 10 years ago and has served them well but like all old systems, newer technologies have come along that are slicker, more integrated and higher functioning in general. Your boss has come to you and asked you to begin the process of researching solutions. You could
Build a new one – probably from scratch to use newer technologies
Analyze commercial purchase-able cloud based solutions
Required:
Create a framework to evaluate all/any short term and longer term costs associated with software ownership. Build versus buy. Creativity and original ideas and concepts are encouraged. Use , use lecture material and use your intuition.
Answer:
Following are the solution to the given question:
Explanation:
The cloud-based CRM system may best be used by companies because it has regular releases featuring additional features focused on customer listening and monitoring market dynamics as requirements.
The first stage issue could be the problem faced by the company. When your company demands were appropriately addressed within such a product not already covered by edge case, the decision to build a new CRM may well be justifiable.
Build:
The in-house IT teams have varying skills in CRM design, based on experience. Like databases, information development, and management.We have to construct the integration from scratch.CRM can be developed to match your current business & processes exactly.Whether there is any management issue, you can solve it.We only know in this how in-house CRM it will cost.Hardware & environment in-house systems have had to be configured.Buy:
CRM vendors create a browser system and have support personnel to even get experience.With integrating with the other systems, a CRM system is built.With the most industry in accordance, a vendor establishes a structure that can be modified according to company requirements.CRM bid committee client feedback improvements and fixes.The system is designed and marketed in this respect.And this is immediately hosted ready and hardly ever needs to be configured on this solution.The greatest option for a CRM system would be to establish a large company with many existing IT resources and save money by removing long-term costs for subscriptions. It's doesn't satisfy your requirements by using your existing system. If the company is tiny, you would be able to purchase a leading CRM system that is based on their demands.
Therefore the business pre-purchases most of the CRM system. But it is extremely vital to realize why companies find a custom system if you're choosing for the prebuild solution.
Unfortunately, not all firms were suited to the CRM system.
The largest companies employ Microsoft's dynamics dynamic 365 again for the smallest businesses.
This system below gives techniques to increase efficiency and profitability.
It can offer various benefits if businesses buy a ready-made CRM system
It has a lifetime permit- It is beneficial because you must only CRM once, but you must pay a significant amount for the product.
Or for a certain duration, such as month, year, membership - The cost may be affordable for a subscription but you should pay monthly.
Software copy to put on the computer of your firm.
Mark is flying to Atlanta. The flight is completely full with 200 passengers. Mark notices he dropped his ticket while grabbing a snack before his flight. The ticket agent needs to verify he had a ticket to board the plane. What type of list would be beneficial in this situation?
Answer:
The list that would be helpful in this situation would be a list of people in the airport
Hope This Helps!!!
1) Declare an ArrayList named numberList that stores objects of Integer type. Write a loop to assign first 11 elements values: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024. Do not use Math.pow method. Assign first element value 1. Determine each next element from the previous one in the number List. Print number List by using for-each loop.
Answer:
Explanation:
The following is written in Java and uses a for loop to add 10 elements to the ArrayList since the first element is manually added as 1. Then it calculates each element by multiplying the previous element (saved in count) by 2. The program works perfectly and without bugs. A test output can be seen in the attached image below.
import java.util.ArrayList;
class Brainly {
public static void main(String[] args) {
ArrayList<Integer> numberList = new ArrayList<>();
numberList.add(0, 1);
int count = 1;
for (int i = 1; i < 11; i++) {
numberList.add(i, (count * 2));
count = count * 2;
}
for (Integer i : numberList) {
System.out.println(i);
}
}
}
what is the best programming language now
Answer:
python is the best programming language
Answer:
The 9 Best Programming Languages to Learn in 2021
JavaScript. It's impossible to be a software developer these days without using JavaScript in some way. ...
Swift. If you're interested in Apple products and mobile app development, Swift is a good place to start. ...
Scala. ...
Go. ...
Python. ...
Elm. ...
Ruby. ...
C#
Write a program that asks the user to enter 5 test scores. The program will display a letter grade for each test score and an average grade for the test scores entered. Three functions are needed for this program.
Answer:
The program in C++ is as follows:
#include <iostream>
using namespace std;
double average(double s1, double s2, double s3, double s4, double s5){
double avg = (s1 + s2 + s3 + s4 + s5)/5;
return avg;}
char lGrade(double score){
char grade;
if(score>= 90 && score <= 100){ grade ='A'; }
else if(score>= 80 && score <= 89){ grade ='B'; }
else if(score>= 70 && score <= 79){ grade ='C'; }
else if(score>= 60 && score <= 69){ grade ='D'; }
else if(score < 60){ grade ='F'; }
return grade;}
int main(){
double s1,s2,s3,s4,s5;
cin>>s1>>s2>>s3>>s4>>s5;
double avg = average(s1,s2,s3,s4,s5);
cout<<s1<<" "<<lGrade(s1)<<endl;
cout<<s2<<" "<<lGrade(s2)<<endl;
cout<<s3<<" "<<lGrade(s3)<<endl;
cout<<s4<<" "<<lGrade(s4)<<endl;
cout<<s5<<" "<<lGrade(s5)<<endl;
cout<<avg<<" "<<lGrade(avg)<<endl;
return 0;}
Explanation:
The three functions to include in the program are not stated; so, I used the following functions in the program
1. The main function
2. average function
3. Letter grade function
The average function begins here
double average(double s1, double s2, double s3, double s4, double s5){
This calculates the average
double avg = (s1 + s2 + s3 + s4 + s5)/5;
This returns the calculated average
return avg;}
The letter grade function begins here
char lGrade(double score){
This declares the grade
char grade;
If score is between 90 and 100 (inclusive), grade is A
if(score>= 90 && score <= 100){ grade ='A'; }
If score is between 00 and 89 (inclusive), grade is B
else if(score>= 80 && score <= 89){ grade ='B'; }
If score is between 70 and 79 (inclusive), grade is C
else if(score>= 70 && score <= 79){ grade ='C'; }
If score is between 60 and 69 (inclusive), grade is D
else if(score>= 60 && score <= 69){ grade ='D'; }
If score is less than 60, grade is F
else if(score < 60){ grade ='F'; }
This returns the calculated grade
return grade;}
The main begins here
int main(){
This declares the 5 scores
double s1,s2,s3,s4,s5;
This gets input for the 5 scores
cin>>s1>>s2>>s3>>s4>>s5;
This calls the average function for average
double avg = average(s1,s2,s3,s4,s5);
This calls the letter grade function for the 5 scores
cout<<s1<<" "<<lGrade(s1)<<endl;
cout<<s2<<" "<<lGrade(s2)<<endl;
cout<<s3<<" "<<lGrade(s3)<<endl;
cout<<s4<<" "<<lGrade(s4)<<endl;
cout<<s5<<" "<<lGrade(s5)<<endl;
This calls the average function for the average
cout<<avg<<" "<<lGrade(avg)<<endl;
A set of blocks contains blocks of heights 1,2, and 4 centimeters. Imagine constructing towers of piling blocks of different heights directly on top of one another. (A tower of height 6 cm could be obtained using six 1-cm blocks, three 2-cm blocks, one 2-cm block with one 4-cm block on top... etc) Let t be the number of ways to construct a tower of height n cm using blocks from the st ( assume an unlimited supply of blocks of each size).
Required:
Find a recurrence relation for t1,t2,t3...
Answer:
In studies about new medicines, researchers usually give one group of patients the medicine that is designed to treat an illness. They give another group of patients a placebo, which is taken the same way as the medicine but does not actually contain the ingredients of any medicine. Different medicines are tested in different experiments, but the placebos usually contain the same non-medical ingredients. If both groups of patients are healed, then researchers cannot be sure whether the medicine caused improvement, but if the group given the medicine is healed while the group given the placebo remains ill, researchers can conclude that the medicine causes the illness to go away.
In medical experiments, which group receives placebos?
the experimental group
the control group
both the experimental and control groups
neither the experimental nor control group
Explanation:
Write a Java program to create a class called Cars. The class should include three instance variables: makes (type: String), models (type: String), and years (type: int); and two methods: a constructor() to initialize three variables and a show() to display the information of a car. Write a class called TestCars to test the class Cars. This class should be able to read the makes, models, and years of three cars from screen input, create three-car objects using the constructor() and display each car's make, model, and years using the show(). (5pts)
Answer:
Explanation:
This code was written in Java. It creates the Cars class with the requested variables and methods. It also creates the TestCars class which asks the user for the necessary inputs and then creates three Cars objects and passes the input values to the constructors. Finally, it uses the show() method on each object to call the information. A test has been created and the output can be seen in the attached image below.
import java.util.Scanner;
class TestCars{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter Car Make: ");
String make1 = in.next();
System.out.print("Enter Car Model: ");
String model1 = in.next();
System.out.print("Enter Car Year: ");
int year1 = in.nextInt();
System.out.print("Enter Car Make: ");
String make2 = in.next();
System.out.print("Enter Car Model: ");
String model2 = in.next();
System.out.print("Enter Car Year: ");
int year2 = in.nextInt();
System.out.print("Enter Car Make: ");
String make3 = in.next();
System.out.print("Enter Car Model: ");
String model3 = in.next();
System.out.print("Enter Car Year: ");
int year3 = in.nextInt();
Cars car1 = new Cars(make1, model1, year1);
Cars car2 = new Cars(make2, model2, year2);
Cars car3 = new Cars(make3, model3, year3);
car1.show();
car2.show();
car3.show();
}
}
class Cars {
String makes, models;
int years;
public Cars(String makes, String models, int years) {
this.makes = makes;
this.models = models;
this.years = years;
}
public void show() {
System.out.println("Car's make: " + this.makes);
System.out.println("Car's model: " + this.models);
System.out.println("Car's year: " + this.years);
}
}
Prepare an algorithm and draw a corresponding flowchart to compute the
mean value of all odd numbers between 1 and 100 inclusive.
Answer:
Algorithm :
1.START
2. sum=0 ; n=1 ; length = 1
3. sum = sum + n
4. n = n + 2
5. length = length + 1
6. Repeat steps 3, 4 and 5 until n <= 99
7. mean = sum / length
8. print(mean)
Explanation:
Sum initializes the addition of the odd numbers
n starts from 1 and increments by 2, this means every n value is a odd number
The condition n <= 99 ensures the loop isn't above range isn't above 100 ;
The length variable, counts the number of odd values
Mean is obtained by dividing the SUM by the number of odd values.