Write a Python Class Flower That Has Three Instance Variables of Type

11

Write a Python class, Flower, that has three instance variables of type str, int, and float, that respectively represent the nam

e of the flower, its number of petals, and its price. Your class must include a constructor method that initializes each variable to an appropriate value, and your class should include methods for setting the value of each type, and retrieving the value of each type.

1 answer:

6 0

Answer:

The python class is shown on the first uploaded image

Explanation:

You might be interested in

Answer:

Various campaigns and awareness program can be launched to encourage women to study computers.

Explanation:

Ada Lovelace was a great mathematician and is famous for computing. She was very fond of mathematics. She did some exceptional work on various computer concepts. Thus she is considered as the first computer programmer. While Grace Hopper was a well known computer compiler and a computer scientist.

So it is clear from above that computer programming or studying about computers is not a male dominating thing. Women have done exceptionally good in this field.

Women should be encouraged more about studying and learning computers and programming languages. Various campaigns can be launched to spread the awareness. It should brought to public notice that studying computers does not require extra skills or knowledge and everybody can study and excel in them.

Free study programs or classes can be organised for the girls and women to learn about computers and different programming languages so that more and more women can come enroll themselves in the program and study computers.

Cc or carbon copy i think

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

double x1,x2,x3,x4,sum,output;//declaring variables..

cout<<"Enter the variables"<<endl;

cin>>x1>>x2>>x3>>x4;//taking input of the time...

sum=x1+x2+x3+x4;//calculating the sum...

output=sum*x1*x2*x3*x4;

cout<<"The asnwer is "<<output<<endl;//printing the temperature..

return 0;

}

Explanation:

I have taken 6 double variables sum to hold the sum of variables and output is to hold the answer.Then calculating printing the output.

Answer:

  1. import java.util.Scanner;
  2. public class Main {
  3. public static void main(String[] args) {
  4. Scanner input = new Scanner(System.in);
  5. System.out.print("Please enter two characters: ");
  6. String inputStr = input.nextLine();
  7. if(inputStr.charAt(0) == 'B' || inputStr.charAt(0) == 'b'){
  8. System.out.println("Biology");
  9. }
  10. else if(inputStr.charAt(0) == 'C' || inputStr.charAt(0)== 'c'){
  11. System.out.println("Computer Science");
  12. }
  13. else if(inputStr.charAt(0) == 'I' || inputStr.charAt(0) == 'i')
  14. {
  15. System.out.println("Information Technology and Systems");
  16. }
  17. else{
  18. System.out.println("Invalid major");
  19. }
  20. int num = Character.getNumericValue(inputStr.charAt(1));
  21. if(num >= 1 && num <= 4){
  22. switch (num){
  23. case 1:
  24. System.out.println("freshman");
  25. break;
  26. case 2:
  27. System.out.println("sophomore");
  28. break;
  29. case 3:
  30. System.out.println("junior");
  31. break;
  32. case 4:
  33. System.out.println("senior");
  34. break;
  35. }
  36. }
  37. else{
  38. System.out.println("Invalid year status");
  39. }
  40. }
  41. }

Explanation:

The code consists of two main parts. The part 1 is to validate the input major and print out the major according to the input character (Line 10 -22). If the input character is not matched with the target letters, a message invalid major will be displayed.

The part 2 is to validate the year status to make sure it only fall within the range of 1-4  (Line 26 -45). If within the range, the program will display the year major accordingly. If not a message invalid year status will be displayed.

The first one is the best one

Write a Python Class Flower That Has Three Instance Variables of Type

Source: https://en-ya.guru/computers_and_technology/question-5890553.html

0 Response to "Write a Python Class Flower That Has Three Instance Variables of Type"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel