Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
sensors.io code:
lass Sensor {
public:
virtual float read() = 0;
virtual const char* sensorName();
protected:
Sensor(int p) : pin(p) {}
protected:
int pin;
};
class Thermistor : public Sensor {
public:
Thermistor(int);
const char* sensorName();
float read();
};
class LightSensor : public Sensor {
public:
LightSensor(int);
const char* sensorName();
float read();
};
// TODO write the Thermistor and LightSensor constructor, sensorName,
// and read methods
Sensor* sensors[2];
void setup() {
Serial.begin(9600);
sensors[0] = new Thermistor(A3);
sensors[1] = new LightSensor(A0);
}
int sensorno = 0;
void loop() {
// TODO write code to check if data is available from the serial port.
// If the user types in a '0', change the sensorno to 0.
// If the user types in a '1', change the sensorno to 1.
Sensor* mysensor = sensors[sensorno];
Serial.print(mysensor->sensorName());
Serial.print(": ");
Serial.println(mysensor->read());
delay(1000);
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Knowledge Booster
Similar questions
- Refer again to the UML Class Description for Student. Write the code for the class_text method using a dictionary structure to assign the appropriate text value for the class_code value.arrow_forwardObject oriented programming Using C++ programming language Creating program make user insert his birthday date yy/mm/dd and display his Astrological sign using four of these Threads inheritance-1 vector-2 opreator overloading-3 Template-4 Expection Handling -5 class-6 freind function and friend-7 classarrow_forwardDescribe how classes are implemented.arrow_forward
- class box { int width; int height; int length; int volume; void volume(int height, int length, int width) { volume = width*height*length; } } class Prameterized_method { public static void main(String args[]) { box obj = new box(); obj.height = 1; obj.length = 5; obj.width = 5; obj.volume(3,2,1); System.out.println(obj.volume); } } Give result for the code Java Try to do ASAParrow_forwardTask 5 Create an Employee Class that will have Two instance variable: name and workingPeriod A class method named employeeByJoiningYear(): To create an Employee object by joining year for calculating the working period It will have two Parameter name and year A static method experienceCheck() to check if an Employee is experienced or not It will take working period and gender as parameter If an employee's working period is less than 3, he or she is not experienced [You are not allowed to change the code below] # Write your code here employee1 = Employee('Dororo', 3) employee2 = Employee.employeeByJoiningYear('Harry', 2016) 6 print(employee1.workingPeriod) print(employee2.workingPeriod) print(employee1.name) print(employee2.name) print(Employee.experienceCheck(2, "male")) print(Employee.experienceCheck(3, "female")) Оutput %3D 3 Dororo Harry He is not experienced She is experiencedarrow_forwardc# LANGUAGE. Create a Product class then create an object from that class using User Input. The program must have Constructor.arrow_forward
- public class Person { private String personID; private String firstName; private String lastName; private String birthDate; private String address; public Person(){ personID = ""; firstName = ""; lastName = ""; birthDate = ""; address = ""; } public Person(String id, String first, String last, String birth, String add){ setPerson(id,first,last,birth,add); } public void setPerson(String id, String first, String last, String birth, String add){ personID = id; firstName = first; lastName = last; birthDate = birth; address = add; } public String getFirstName(){ return firstName; } public String getLastName(){ return lastName; } public String getBirthdate(){ return birthDate; } public String getAddress(){ return address; } public void print(){ System.out.print("\nPerson ID = " + personID); System.out.print("\nFirst Name = " +firstName); System.out.print("\nLast Name = " +lastName); System.out.print("\nBirth Date = " +birthDate); System.out.print("\nAddress = " +address); } public String…arrow_forwardC# List the differences between CommissionEmployee class and BasePlusCommissionEmployee class public class BasePlusCommissionEmployee { public string FirstName { get; } public string LastName { get; } public string SocialSecurityNumber { get; } private decimal grossSales; private decimal commissionRate; private decimal baseSalary; public BasePlusCommissionEmployee(string firstName, string lastName, string socialSecurityNumber, decimal grossSales, decimal commissionRate, decimal baseSalary) { FirstName = firstName; LastName = lastName; SocialSecurityNumber = socialSecurityNumber; GrossSales = grossSales; CommissionRate = commissionRate; BaseSalary = baseSalary; } public decimal GrossSales { get { return grossSales; } set { if (value < 0) // validation { throw new ArgumentOutOfRangeException(nameof(value),…arrow_forwardclass FoodItem: # TODO: Define constructor with parameters to initialize instance # attributes (name, fat, carbs, protein) def get_calories(self, num_servings): # Calorie formula calories = ((self.fat * 9) + (self.carbs * 4) + (self.protein * 4)) * num_servings; return calories def print_info(self): print('Nutritional information per serving of {}:'.format(self.name)) print(' Fat: {:.2f} g'.format(self.fat)) print(' Carbohydrates: {:.2f} g'.format(self.carbs)) print(' Protein: {:.2f} g'.format(self.protein)) if __name__ == "__main__": food_item1 = FoodItem() item_name = input() amount_fat = float(input()) amount_carbs = float(input()) amount_protein = float(input()) food_item2 = FoodItem(item_name, amount_fat, amount_carbs, amount_protein) num_servings = float(input()) food_item1.print_info() print('Number of calories for {:.2f} serving(s):…arrow_forward
- public class Plant { protected String plantName; protected String plantCost; public void setPlantName(String userPlantName) { plantName = userPlantName; } public String getPlantName() { return plantName; } public void setPlantCost(String userPlantCost) { plantCost = userPlantCost; } public String getPlantCost() { return plantCost; } public void printInfo() { System.out.println(" Plant name: " + plantName); System.out.println(" Cost: " + plantCost); }} public class Flower extends Plant { private boolean isAnnual; private String colorOfFlowers; public void setPlantType(boolean userIsAnnual) { isAnnual = userIsAnnual; } public boolean getPlantType(){ return isAnnual; } public void setColorOfFlowers(String userColorOfFlowers) { colorOfFlowers = userColorOfFlowers; } public String getColorOfFlowers(){ return colorOfFlowers; } @Override public void printInfo(){…arrow_forwardAlias is also known as a data type. True False We can use Hierarchy to combine two values of a dimension into a single category. True False ........... Which of the following can include multiple version of the same worksheet? * 0/2 Dashboard and stories Stories but not dashboards Dashboards but not stories Neither dashboards nor stories ......... A color gradient is used for which of the following * 0/2 Discrete measure Continuous measure Both continuous and discrete N/Aarrow_forwardUML for the following Code: public class ProductOrder { private int numBook = 0; private int numCD = 0; private int numDVD = 0; public ProductOrder(int numBook, int numCD, int numDVD){ this.numBook = numBook; this.numCD = numCD; this.numDVD = numDVD; } public int getBook(){ return numBook; } public void setBook(int numBook){ this.numBook = numBook; } public int getCD(){ return numCD; } public void setCD(int numCD){ this.numCD = numCD; } public int getDVD(){ return numDVD; } public void setDVD(int numDVD){ this.numDVD = numDVD; } public int getProductTotal(){ return getBook() + getCD() + getDVD(); } }arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education