Answer:
#main function start
def main():
#list to store names entered by user
name_list=[]
#variable to take input from user to keep rotating the loop and take input from user again and again
ch='y'
fname=""
lname=""
while ch=='y' or ch=='Y':#keep the loop taking input from user till user do not want to enter more
#take input from user
name=[]
fname=input("Enter first name: ")
lname=input("Enter last name: ")
name.append(fname)
name.append(lname)
#append the previously input first and last name in main list
name_list.append(name)
ch=input("Do you want to continue: (y/Y for yes)")
#main function end
#get file name from user
filename=input("Enter output file name")
#open file in write mode
file=open(filename,"w")
#keep loop add data in file till main list 'name_list' have
for i in name_list:
#Write data in file
file.write("%s, %s\r\n" % (i[0],i[1]))
#close the file
file.close()
#call main function
main()
Explanation:
input the above code and see output
Can you please at least give me some part of the code. At least how to start it in C++. Thank you!
Project 5: You will design and implement various classes and write a program to manage one of the following a bank, a hospital, a library, a business, an organization, etc.) The program must do the following:
1. Allow the initialization of the different attributes of the objects from the keyboard.
2. Allow the initialization of the different attributes from a file
3. Perform calculations on one (or more) of the attributes (e.g. calculateInterest, generateHospitalBill, calculateCheckedBooks, etc.)
4. Output a report of all objects created. The report called for by requirement 4 should output all information about each object. You will need to take advantage of the capabilities of C++ classes, inheritance and overriding.
Program Design:
1. Create at least one base class. All data members have to be private. Your main function and any function that it calls should use the member functions of this class for all transactions.
2. Create at least two derived class of the base class described in the previous point.
3. The program will maintain arrays of objects that interacts with each other to manage the designated establishment (bank, hospital, library, etc.). Please do not use anything more sophisticated than an array.
4. Keep the program simple. I am interested in whether you can demonstrate basic competence in the use of classes, inheritance, and good design.
5. All data members in the classes must be private. This is to assure that you use the C++ capabilities that this assignment is all about. Do not use any global variables.
6. When the user decides to quit the updated information is saved back to the secondary storage to give the user the option to either start fresh or continue where he/she left off at the beginning of the next execution
Answer:
Explanation:
The objective of this question is to compute a program that involve using a C++ code for designing and implementing a Bank Account Management Simulator with integrated file storage for saving details to secondary storage.
When writing this code I notice the words are more than 5000 maximum number of characters the text editor can contain, so i created a word document for it. The attached file to the word document can be found below.
Output values below an amount
Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value.
Ex: If the input is 5 50 60 140 200 75 100, the output is:
For coding simplicity, follow every output value by a space, including the last one.
Such functionality is common on sites like Amazon, where a user can filter results.
LAB
ACTIVITY
8.3.1: LAB: Output values below an amount
0 / 10
Submission Instructions
These are the files to get you started.
main.cpp
Download these files
Compile command
g++ main.cpp -Wall -o a.out
We will use this command to compile your code
Answer:
def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):
for value in user_values:
if value < upper_threshold:
print(value)
def get_user_values():
n = int(input())
lst = []
for i in range(n):
lst.append(int(input()))
return lst
if __name__ == '__main__':
userValues = get_user_values()
upperThreshold = int(input())
output_ints_less_than_or_equal_to_threshold(userValues, upperThreshold)
Explanation:
8) Which of the following statements is FALSE?
1) You will likely need to use a combination of both popular and scholarly resources in your research
2) The CRAAP test can be used to help evaluate all of your sources
3) Academic journal articles are always unbiased in their analysis
4) Popular resources tend to be easier to read than scholarly articles
Answer:
3) Academic journal articles are always unbiased in their analysis.
Explanation:
The Academic journals are not always unbiased. There can be some authors which may write in some situation and bias the articles. It is important to analyse source and reliability of the article before relying on it. An unbiased author will try to capture picture fairly. The unbiased author presents the facts as it is and does not manipulates the truth.
Advanced Sounds is engaging in a full upgrade of its Windows Server 2003 network to Windows Server 2008. The upgrade includes using Windows Server 2008 Active Directory. Advanced Sounds has pioneered many technological innovations and is very concerned about keeping its network and computer systems secure. Advanced Sounds Information Technology (IT) Department hires you to help them implement Windows Server 2008 Active Directory. Assume the following:
All email servers have been consolidated back in the New York City Complex.
Most all the other applications running on Windows Servers are distributed at all sixteen locations.
Each location at minimum has a file server, a print server and a local application server.
All locations have adequate Wide Area network connections with available capacity; 10 Mbps links
The New York location has enough network capacity to serve all 16 locations.
There are 500 people at the New Your City complex.
There are 200 people at the Quebec City location and 200 at the Montreal location.
There are 40-50 people at each outlet store.
Advanced Sounds IT Department has formed a small installation planning committee consisting of the IT server operations manager, two system programmers, the current Active Directory administrator, and you. After the first meeting they have asked you to prepare a small report to address the following questions:
A. What information is required as input to the initial installation involving Active Directory? a=
B. How many Active directory servers do you propose?
C. Where will the Active directory server(s) be located?
Answer:
cs
Explanation:
During an investigation of a cybercrime, the law enforcement officers came across a computer that had the hard drive encrypted. Chose the best course of action they should take to access the data on that drive.
a. Use image filtering techniques to see what's behing the encrypted files.
b. Try to convince the owner of the computer to give you to decryption key/password.
c. Identify the encryption algorithm and attempt a brute force attack to get access to the file.
d. Disconnect the hard drive from power so the encryption key can be exposed on the next power up.
e. Try to copy the drive bit by bit so you can see the files in each directory.
Answer:
b. Try to convince the owner of the computer to give you to decryption key/password.
Explanation:
Encrypted hard drives have maximum security and high data protection. to access them you need to enter a password to unlock them.
The image filtering technique is a method that serves to selectively highlight information contained in an image, for which it does not work.
The encryption algorithm is a component used for the security of electronic data transport, not to access data on an encrypted hard drive.
The encryption key is used in encryption algorithms to transform a message and cannot be exposed by disconnecting the hard drive from its power source.
Convert each of the following for loops into an equivalent while loop. (You might need to rename some variables for the code to compile, since all four parts a-d are in the same scope.)
// a.
System.out.println("a.");
int max = 5;
for (int n = 1; n <= max; n++) {
System.out.println(n);
}
System.out.println();
// b.
System.out.println("b.");
int total = 25;
for (int number = 1; number <= (total / 2); number++) {
total = total - number;
System.out.println(total + " " + number);
}
System.out.println();
// c.
System.out.println("c.");
for (int i = 1; i <= 2; i++) {
for (int j = 1; j <= 3; j++) {
for (int k = 1; k <= 4; k++) {
System.out.print("*");
}
System.out.print("!");
}
System.out.println();
}
System.out.println();
// d.
System.out.println("d.");
int number = 4;
for (int count = 1; count <= number; count++) {
System.out.println(number);
number = number / 2;
}
Answer:
~CaptnCoderYankee
Don't forget to award brainlyest if I got it right!
Write a Java program that reads from the user four grades between 0 and 100. The program the, on separate ines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Make sure to properly label your output. Use escape characters to line up the outputs after the labels.
Answer:
import java.util.*;
public class Grade {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double[] grades = new double[4];
for (int i=0; i<4; i++){
System.out.print("Enter a grade: ");
grades[i] = input.nextDouble();
}
double lowest = grades[0];
double highest = grades[0];
double total = 0;
for (int i=0; i<4; i++){
System.out.println("Grade " + (i+1) + " is: " + grades[i]);
if(grades[i] >= highest)
highest = grades[i];
if(grades[i] <= lowest)
lowest = grades[i];
total += grades[i];
}
double average = total/4;
System.out.println("The highest grade is: " + highest);
System.out.println("The lowest grade is: " + lowest);
System.out.println("The average is: " + average);
}
}
Explanation:
Ask the user for the grades and put them in the grades array using a for loop
Create another for loop. Inside the loop, print the grades. Find highest and lowest grades in the grades array using if-structure. Also, add each grade to the total.
When the loop is done, calculate the average, divide the total by 4.
Print the highest grade, lowest grade and average.
Given: The following if statement uses an overloaded > operator to determine whether the price of a Car object is more than $5000. Car is a struct and myCar is an object of Car. Each Car object has two variables: id (int) and price (float). As you can see in the following code, the ID of myCar is 12345 and the price is $6,000.
Car myCar = {12345, 6000.};
float price = 5000;
if (myCar > price)
cout << "My car price is more than $5,000.\n";
Which one of the following function prototypes is correct syntax to overload the > operator based on the if statement above.
a. void operator>(float price);
b. bool operator>(Car& car, float price);
c. bool operator >(float amt);
d. bool operator>(Car& yourCar);
e. none of the above
Answer:
Option(c) is the correct answer to the given question.
Explanation:
In the given question car is the structure and mycar is the instance or the object of the class also the object mycar holds two variables of type integer and the one float variable .
Following are the syntax of operator overload in C++ programming language
return -type operator operator-symbol(datatype variable name )Now according to the question the option(c) follows the correct syntax of operator overload
All the other option do not follow the correct prototype that's why these are incorrect option .
7d2b:00a9:a0c4:0000:a772:00fd:a523:0358 What is IPV6Address?
Answer:
From the given address: 7d2b:00a9:a0c4:0000:a772:00fd:a523:0358
We can see that:
There are 8 groups separated by a colon.Each group is made up of 4 hexadecimal digits.In general, Internet Protocol version 6 (IPv6) is the Internet Protocol (IP) which was developed to deal with the expected anticipation of IPv4 address exhaustion.
The IPv6 addresses are in the format of a 128-bit alphanumeric string which is divided into 8 groups of four hexadecimal digits. Each group represents 16 bits.
Since the size of an IPv6 address is 128 bits, the address space has [tex]2^{128}[/tex] addresses.
I need the answer to the below question *ASAP*
2 4 9
Explanation:
Basically what I thought was the way was, since 2 is first, then its 1, then since 4 is second, it's added second, lastly to get the last oneI added them all and got 9 so that's third.
Answer:
Does not exist.
Explanation:
The answer is not in the option:
Let's analyse the code:
random.randint(2,4)
This means take in random integer numbers starting with 2 and ending with 4.
Meaning numbers : 2, 3 and 4
Next math.pow(a,2) means a× a = a2
So when we input 2 the function;
math.pow(a,2) returns an integer 4
You do same for input 3 , it returns 9.
For input 4 it returns 16.
And the result is encapsulated in the function string(). Meaning display the result as a string:
4 9 16
You are working at the Acme company that has the following environment: 400 Windows Servers 2. 8000 Windows client devices (laptops running Windows os) 40 Linux servers Active Directory Domain Services to provide dns services to all the hosts, both Windows and Linux. Acme acquires a small research company, Uni-Tech that uses Unix servers for all of its applications. For host resolution they use BIND
a. Describe what BIND is and what the acronym stands for? BIND stands for Berkley Internet Name Domain. BIND allows you to pick one of your computers to act as the DNS server.
b. This acquisition happens very quickly and on day one the business needs people at Uni-Tech to connect to hosts at Acme using hosts names that can be resolved by Active Directory. Describe a method for integrating the two environments that does not require too many individual tasks that will take many hours. (10) Describe how you would test to make sure your integration is working correctly.
Answer: Provided in the explanation section
Explanation:
(a). BIND is a type of DNS server used on the internet, actually it is reported to be most widely used DNS server on the internet. Also BIND is the de-facto standard on Unix like operating systems and Linux. Thus it can be used to locate computers on a network using domain names instead of their IP addresses. BIND was originally programmed at the University of California, Berkeley in the 1980s, this was made possible by a grant from US based DARPA program.
Originally, BIND stood for Berkeley Internet name daemon, but nowadays it is called Berkeley Internet name domain.
(b). In some of the clients in windows and Windows servers we will install LDP. By the LDP.exe we can test tDNS, Active directory woking , even we can add or modify. LDP is used to test and verify the Active Directory objects. We will install in windows machine then open the software, then from the menu we will select connect and type the IP adress of the Active Directory then we will select or type the objects of Active directory. For Linux system we have to openldap and can search the AD.
From Linux or Unix we can use the nmap tool which can test the network connectivity between all the computers whether it is windows or Linux. By nmap we can test by ICMP protocol to verify the network connectivity. By nmap we can scan all the port which are required to open from client to the server. We can also use nslookup to test DNS server from the client. By nslookup we can check that client can connect the server.
Write a program that reads a list of words. Then, the program outputs those words and their frequencies. Ex: If the input is: hey hi Mark hi mark the output is: hey 1 hi 2 Mark 1 hi 2 mark 1
Answer:
#Declare variable to get the input
#list from the user
input_list = input()
#split the list into words by space
list = input_list.split()
#Begin for-loop to iterate each word
#to get the word frequency
for word in list:
#get the frequency for each word
frequency=list.count(word)
#print word and frequency
print(word,frequency)
Explanation:
This program that we are told to write will be done by using python programming language/ High-level programming language.
The question wants us to write a program in which the output will be as below;
hey 1
hi 2
Mark 1
hi 2
mark 1
Just by imputing hey hi mark hi mark.
Just copy and run the code below.
#Declare variable to get the input
#list from the user
input_list = input()
#split the list into words by space
list = input_list.split()
#Begin for-loop to iterate each word
#to get the word frequency
for word in list:
#get the frequency for each word
frequency=list.count(word)
#print word and frequency
print(word,frequency)
In this exercise we have to use the knowledge in computational language in python to write the following code:
We have the code can be found in the attached image.
So in an easier way we have that the code is
input_list = input()
list = input_list.split()
for word in list:
frequency=list.count(word)
print(word,frequency)
See more about python at brainly.com/question/18502436
What is a manifold on a vehicle
Answer:
the part of an engine that supplies the fuel/air mixture to the cylinders
Explanation:
There is also an exhaust manifold that collects the exhaust gases from multiple cylinders into a smaller number of pipes
In addition to compiling the list of user access requirements, applications, and systems, the BIA also includes processes that are ____________. These processes safeguard against any risks that might occur due to key staff being unavailable or distracted.
Answer:
automated
Explanation:
Basically a Business Impact Analysis (BIA) estimates and determines the effects of a business activity and process disturbances. These disruptions can be natural or electronic disasters. It also collects information which is used to establish recovery plan. It identifies the business vulnerabilities and works on the strategies in order to reduce such potential hazards. The BIA involves both manual and automated processes. BIA involves automated processes which include the automated software tools that enables the protection of the confidential information of the users and also generates automated reports about the critical business processes.
Max magnitude Write a method maxMagnitude() with two integer input parameters that returns the largest magnitude value. Use the method in a program that takes two integer inputs, and outputs the largest magnitude value. Ex: If the inputs are: 5 7 the method returns: 7 Ex: If the inputs are: -8 -2 the method returns: -8 Note: The method does not just return the largest value, which for -8 -2 would be -2. Though not necessary, you may use the absolute-value built-in math method. Your program must define and call a method: public static int maxMagnitude(int userVal1, int userVal2)
Answer:
The java program is as follows.
import java.lang.*;
public class Numbers
{
//variables to hold two numbers
static int num1=-8, num2=-2;
//method to return integer with higher magnitude
public static int maxMagnitude(int userVal1, int userVal2)
{
if(Math.abs(userVal1) > Math.abs(userVal2))
return userVal1;
else
return userVal2;
}
public static void main(String[] args) {
int max = maxMagnitude(num1, num2);
System.out.println("The number with higher magnitude among "+num1+ " and "+num2+ " is "+max);
}
}
OUTPUT
The number with higher magnitude among -8 and -2 is -8
Explanation:
1. Two integer variables are declared to hold the two numbers. The variables are declared at class level (outside main()) and declared static.
2. The variables are initialized with any random value.
3. The method, maxMagnitude(), takes the two integer parameters and returns the number with higher magnitude. Hence, return type of the method is int.
public static int maxMagnitude(int userVal1, int userVal2)
4. This method finds the number with higher magnitude using the Math.abs() method inside if-else statement.
if(Math.abs(userVal1) > Math.abs(userVal2))
return userVal1;
else
return userVal2;
5. Inside main(), the method, maxMagnitude(), is called. This method takes the two variables as input parameters.
6. The integer returned by the method, maxMagnitude() is assigned to a local integer variable, max, as shown.
int max = maxMagnitude(num1, num2);
7. The result is displayed to the user as shown.
System.out.println("The number with higher magnitude among "+num1+ " and "+num2+ " is "+max);
8. The class variables and the method, maxMagnitude(), are declared static so that they can be used and called inside main().
9. The variable, max, is called local variable since it can be used only within the main() where it is declared. It is not declared static.
10. The class is declared public since it has the main() method and execution begins with main().
11. The program is saved with the same name as the name of the public class having main(). In this case, the program is saved as Numbers.java.
12. No user input is taken for the two input parameter values. The static variables can be assigned any integer value and the program can be tested accordingly.
Charles Montesquieu believed that the
Legislative Branch should do what?
A. Make laws
B. Enforce laws
C. Interpret laws
elles sone. All Rights Resed.
Answer:
A. Make Laws
Explanation:
Montesquieu believed the ways to go about limiting the power of a monarch would be to split up power among 3 groups, Judicial, Legislative and Executive. The American Presidential system and Constitution used Montesquieu's writings as a foundation for their principles.
Judicial Interprets lawsLegislative Makes lawsExecutive Enforces LawWhich component allows you to enjoy cinematic
or 3-D effects on your computer?
A.Cache memory
B.Ethernet port
C.external hard drive
D.video and sound cards
external hard drive
external hard drive
Answer:
Amswer would be D
Explanation:
The beginning of a free space bitmap looks like this after the disk partition is first formatted: 1000 0000 0000 0000 0000 0000 0000 0000 (the first block is used by the root directory). The system always searches for free blocks starting at the lowest numbered block, so after writing file A, which uses 8 blocks, the bitmap looks like this 1111 1111 1000 0000 0000 0000 0000 0000. Show the bitmap after each of the following actions: (a) File B is written, using 12 blocks (b) File C is written, using 7 blocks (c) File A is deleted (d) File B is deleted (e) File D is written, using 6 blocks (f) File E is written, using 9 blocks Show all steps.
The bitmap is 1110 0000 0001 0000 after some use. The system always looks for free blocks beginning using a contiguous allocation technique.
What is a bitmap?After some use, the new bitmap is 1110 0000 0001 0000. The system employs a contiguous allocation mechanism and starts searching for free blocks at the position.
(a) File B is made up of five blocks, 1111 1111 1111 0000.
b) The batch number 1000 0001 1111 0000 deletes File A.
c) Eight blocks are used for writing in file C.
1111 1111 1111 1100
File B is deleted (d). 1111 1110 0000 1100
Free-space bitmaps are one method used by some file systems to keep track of allocated sectors. Even though the most fundamental implementation of free-space bitmaps is incredibly wasteful, some modern file systems use complex or hybrid versions of them.
Therefore, after some use, the bitmap is 1110 0000 0001 0000. The contiguous allocation strategy is always used by the system to look for free blocks to start with.
To learn more about bitmap, refer to the link:
https://brainly.com/question/26230407
#SPJ2
Your computer is once again out of hard drive and you want to see which folders are consuming the most space on your drive. Which application below will do this? A. CClreaner B. Treesize C MalwareBytes D. Auslogics Disk Defrag
Answer:
I would say cclrearner
Explanation:
This is what helped me with my computer so it may help you but try which one works for you
1. Implement the function dict_intersect, which takes two dictionaries as parameters d1 and d2, and returns a new dictionary which contains only those keys which appear in both d1 and d2, whose values are a tuple of the corresponding values from d1 and d2.
E.g., dict_intersect({'a': 'apple', 'b': 'banana'}, {'b': 'bee', 'c': 'cat'}) should return {'b': ('banana', 'bee')}
2. Implement the function consolidate, which accepts zero or more sequences in the star parameter seqs, and returns a dictionary whose keys consist of values found in those sequences, which in turn map to numbers indicating how many times each value appears across all the sequences.
E.g., consolidate([1,2,3], [1,1,1], [2,4], [1]) should return the dictionary {1: 5, 2: 2, 3: 1, 4: 1}.
Answer:
1
def dict_intersect(d1,d2): #create dictionary
d3={} #dictionaries
for key1,value1 in d1.items(): #iterate through the loop
if key1 in d2: #checking condition
d3[key1]=(d1[key1],d2[key1]) #add the items into the dictionary
return d 3
print(dict_intersect({'a': 'apple', 'b': 'banana'}, {'b': 'bee', 'c': 'cat'})) #display
2
def consolidate(*l1): #create consolidate
d3={} # create dictionary
for k in l1: #iterate through the loop
for number in k: #iterate through the loop d3[number]=d3.get(number,0)+1 #increment the value
return d 3 #return
print(consolidate([1,2,3], [1,1,1], [2,4], [1])) #display
Explanation:
1
Following are the description of program
Create a dictionary i.e"dict_intersect(d1,d2) " in this dictionary created a dictionary d3 .After that iterated the loop and check the condition .If the condition is true then add the items into the dictionary and return the dictionary d3 .Finally print them that are specified in the given question .2
Following are the description of program
Create a dictionary consolidate inside that created a dictionary "d3" .After that iterated the loop outer as well as inner loop and increment the value of items .Return the d3 dictionary and print the dictionary as specified in the given question .
Write a function called unzip that takes as parameter a sequence (list or tuple) called seq of tuples with two elements. The function must return a tuple where the first element is a list with the first members of the seq tuple and the second element is a list with the second members of the seq tuple.
This example clarifies what is required:
Ist =[(1, "one"), (2, "two"), (3, "three")]
tup= unzip(Lst) lst tup
print(tup)
#prints ([1, 2, 3], ['one', two','three'7)
Answer:
Here is the function unzip:
def unzip(lst):
result= zip(*lst)
return list(result)
The complete program in Python is given below:
def unzip(lst):
result= zip(*lst)
return list(result)
lst =[(1, "one"), (2, "two"), (3, "three")]
tup= unzip(lst)
print(tup)
Explanation:
Here zip() function is used in the unzip function. The return type of zip() function is a zip object. This means the function returns the iterator of tuples. This function can be used as its own inverse by using the * operator.
If you do not want to use zip() function then the above program can also be implemented as following which uses a for loop for elements in the given list (lst). This can make a pair of lists (2 tuple) instead of list of tuples:
def unzip(lst):
output = ([ a for a,b in lst ], [ b for a,b in lst ])
return output
lst =[(1, "one"), (2, "two"), (3, "three")]
tup= unzip(lst)
print(tup)
The programs along with their output are attached.
Complete main() to read dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not following that format is incorrect and should be ignored. Use the substring() method to parse the string and extract the date. The input ends with -1 on a line alone. Output each correct date as: 3/1/1990.
Ex: If the input is:
March 1, 1990
April 2 1995
7/15/20
December 13, 2003
-1
then the output is:
3/1/1990
12/13/2003
Given Code:
import java.util.Scanner;
public class DateParser {
public static int getMonthAsInt(String monthString) {
int monthInt;
// Java switch/case statement
switch (monthString) {
case "January":
monthInt = 01;
break;
case "February":
monthInt = 02;
break;
case "March":
monthInt = 03;
break;
case "April":
monthInt = 04;
break;
case "May":
monthInt = 05;
break;
case "June":
monthInt = 06;
break;
case "July":
monthInt = 07;
break;
case "August":
monthInt = 8;
break;
case "September":
monthInt = 9;
break;
case "October":
monthInt = 10;
break;
case "November":
monthInt = 11;
break;
case "December":
monthInt = 12;
break;
default:
monthInt = 00;
}
return monthInt;
}
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
// TODO: Read dates from input, parse the dates to find the one
// in the correct format, and output in mm/dd/yyyy format
}
}
Using the knowledge in computational language in C++ it is possible to write a code that complete main() to read dates from input, one date per line
Writting the code:#include <iostream>
#include <string>
using namespace std;
int DateParser(string month) {
int monthInt = 0;
if (month == "January")
monthInt = 1;
else if (month == "February")
monthInt = 2;
else if (month == "March")
monthInt = 3;
else if (month == "April")
monthInt = 4;
else if (month == "May")
monthInt = 5;
else if (month == "June")
monthInt = 6;
else if (month == "July")
monthInt = 7;
else if (month == "August")
monthInt = 8;
else if (month == "September")
monthInt = 9;
else if (month == "October")
monthInt = 10;
else if (month == "November")
monthInt = 11;
else if (month == "December")
monthInt = 12;
return monthInt;
}
int main ()
{
// TODO: Read dates from input, parse the dates to find the one
// in the correct format, and output in m/d/yyyy format
while(1)
{
//declaring the required variables
int monthInt,dayInt,yearInt;string input;
//receive the input string frim the user
getline(cin,input);
//if the input is -1 then quit
if(input=="-1")
break;
//else try to process the input
try
{
//find and extract the month name and parse it to monthInt
monthInt=DateParser(input.substr(0,input.find(' ')));
//find and extract the day and parse it to dayInt
dayInt=stoi(input.substr(input.find(' '),input.find(", ")));
//find and extract the year and parse it to yearInt
yearInt=stoi(input.substr(input.find(", ")+1,input.length()));
//display the output
cout<<monthInt<<"/"<<dayInt<<"/"<<yearInt<<endl;
}
//catch if any of the exceptions happens
catch(exception& e){}
}
}
See more about C++ at brainly.com/question/19705654
#SPJ1
Write a C++ program to find if a given array of integers is sorted in a descending order. The program should print "SORTED" if the array is sorted in a descending order and "UNSORTED" otherwise. Keep in mind that the program should print "SORTED" or "UNSORTED" only once.
Answer:
The cpp program for the given scenario is as follows.
#include <iostream>
#include <iterator>
using namespace std;
int main()
{
//boolean variable declared and initialized
bool sorted=true;
//integer array declared and initialized
int arr[] = {1, 2, 3, 4, 5};
//integer variables declared and initialized to length of the array, arr
int len = std::end(arr) - std::begin(arr);
//array tested for being sorted
for(int idx=0; idx<len-1; idx++)
{
if(arr[idx] < arr[idx+1])
{
sorted=false;
break;
}
}
//message displayed
if(sorted == false)
cout<< "UNSORTED" <<endl;
else
cout<< "UNSORTED" <<endl;
return 0;
}
OUTPUT
UNSORTED
Explanation:
1. An integer array, arr, is declared and initialized as shown.
int arr[] = {1, 2, 3, 4, 5};
2. An integer variable, len, is declared and initialized to the size of the array created above.
int len = std::end(arr) - std::begin(arr);
3. A Boolean variable, sorted, is declared and initialized to true.
bool sorted=true;
4. All the variables and array are declared inside main().
5. Inside for loop, the array, arr, is tested for being sorted or unsorted. The for loop executes over an integer variable, idx, which ranges from 0 till the length of the array, arr.
6. The array is assumed to be sorted if all the elements of the array are in descending order.
7. If the elements of the array are in ascending order, the Boolean variable, sorted, is assigned the value false and for loop is exited using break keyword. The testing is done using if statement.
8. Based on the value of the Boolean variable, sorted, a message is displayed to the user.
9. The program can be tested for any size of the array and for any order of the elements, ascending or descending. The program can also be tested for array of other numeric data type including float and double.
10. All the code is written inside the main().
11. The length of the array is found using begin() and end() methods as shown previously. For this, the iterator header file is included in the program.
For the PSoC chip what is the minimum voltage level in volts that can be considered to logic one?
Answer:
Asian man the man is one 1⃣ in a and the perimeters are not only
For this assignment, you will create flowchart using Flow gorithm and Pseudocode for the following program example: Hunter Cell Phone Company charges customer's a basic rate of $5 per month to send text messages. Additional rates apply as such:The first 60 messages per month are included in the basic billAn additional 10 cents is charged for each text message after the 60th message and up to 200 messages.An additional 25 cents is charged for each text after the 200th messageFederal, state, and local taxes add a total of 12% to each billThe company wants a program that will accept customer's name and the number of text messages sent. The program should display the customer's name and the total end of the month bill before and after taxes are added.
Answer:
The pseudocode is as given below while the flowchart is attached.
Explanation:
The pseudocode is as follows
input customer name, number of texts
Set Basic bill=5 $;
if the number of texts is less than or equal to 60
Extra Charge=0;
If the number of texts is greater than 60 and less than 200
number of texts b/w 60 and 200 =number of texts-60;
Extra Charge=0.1*(number of texts b/w 60 and 200);
else If the number of texts is greater than 200
number of texts beyond 200 =number of texts-200;
Extra Charge=0.25*(number of texts beyond 200)+0.1*(200-60);
Display Customer Name
Total Bill=Basic bill+Extra Charge;
Total Bill after Tax=Total Bill*1.12;
The following if statement uses an overloaded > operator to determine whether the price of a Car object is more than $5000. Car is a struct and myCar is an object of Car. Each Cor object has two variables: id (int) and price (float). As you can see in the following code, the ID of myCar is 12345 and the price is $6,000. Car myCar - [12345, 6000.); float price - 5000; if (myCar > price) cout << "My car price is more than $5,000/n": Which one of the following function prototypes is correct syntax to overload the > operator based on the if statement above. void operator> float price: O bool operator>(Car & car, float price): bool operator (float amt): bool operator> Car & your Car): None of the above
Answer:
The correct syntax to overload is bool operator (float amt): so, the third statement is right.
Explanation:
Solution
From the given question we have to find which statements is correct for the following function prototype.
Now,
Since the price of a Car object is above $5000, the car here is considered a struct and myCar is an object of Car
Both Car object consists of two variables which are id (int) and price (float)
Thus, from the given example the corresponding code says that the ID of myCar is represented as follows:
myCar - [12345, 6000);
The float price = 5000
Then,
cout << "My car price is more than $5,000/n"
Therefore the following statement bool operator (float amt): is the right syntax to overload.
Which of the following meanings of the plus sign, +, are built-in to the language (and/or standard libraries or classes that we have been using with the language)?
A. Numeric subtraction
B. Numeric addition
C. string concatenation
D. The logical "or" operation
Answer:
Numeric Addition
Explanation:
Literally, the + sign is an arithmetic operator used to perform addition operation between numeric datatypes (integer, float, decimal, double, long integer, etc...)
Its default built in function of the plus is sign is to add variables, constants and/or expressions.
The plus sign is used as follows;
a = 5;
b = 3;
c = a + b
-------------
a + b = 5 + 3 = 8
8 will be saved in variable c. This is only possible using the plus sign.
The plus sign also has other function such as string concatenation but this function is language dependent (i.e. some programming languages do not use + for string concatenation).
Conclusively, the built in function of the plus sign is for numeric addition
If a large organization wants software that will benefit the entire organization—what's known as enterprise application software—the organization must develop it specifically for the business in order to get the functionality required.
Answer:
Hello your question lacks the required options which is : True or False
answer : TRUE
Explanation:
If a large organization wants to develop a software that will benefit the entire organization such software will be known as an enterprise application software and such application software must be developed in such a way that it meets the required purpose for which the organization is designed it for.
An enterprise application software is a computer software developed specially to satisfy the specific needs of an entire organization inside of the individual needs of the people working in the organization.
Write Python code to save the data to a MongoDB collection:Import json module to parse JSON dataImport MongoClient from pymongo to use MongoDBCreate a loop to iterate through the variable with data from Twitter, and for each tweet:Parse these related values: id, text, created_at, user’s screen_name, retweet_count, favorite_count, lang.Use MongoDB’s insert method to add the parsed tweet values to MongoDB collection;Write Python code to query the database:Use find method to search for tweets with lang="en";Use the aggregate method with $sum to compute the total retweets;Use the aggregate method with $count and $group to count the number of tweets by each user (screen_name);
Answer:
Explanation:
The objective of this task is to compute a program that involves the usage of Python code to save the data to MongoDB and to query the database.
Due to the error that occur which makes me to be unable to submit this answer, I've created a word document instead and the attached file can be found below.
Thanks!
What are the best data structures to create the following items? And why?
1. Designing a Card Game with 52 cards.
2. Online shopping cart (Amazon, eBay, Walmart, Cosco, Safeway, ...)
3. Online waiting list (De Anza College class waiting list, ...)
4. Online Tickets (Flight tickets, concert tickets, ...)
Answer:
The best structures to create the following items are
ARRAYHASHMAPS QUEUE SORTED LINK LISTSExplanation:
The best structures to create the following items are:
Array : for the storage of cards in a card game the best data structure to be used should be the Array data structure. this is because the size of the data ( 52 cards ) is known and using Array will help with the storing of the cards values in the Game.Hashmaps : Hashmap data structure should be implemented in online shopping cart this IS BECAUSE items can be easily added or removed from the cart therefore there is a need to map the Items ID or name to its actual database online waiting list are usually organised/arranged in a first-in-first-out order and this organization is best created using the queue data structure Sorted link lists is the best data structure used to create, store and manage online tickets. the sorted link data structure helps to manage insertions and deletions of tickets in large numbers and it also reduces the stress involved in searching through a large number of tickets by keeping the tickets in sorted lists