using c languageDesign an abstract data type called Weather

using c++ language,Design an abstract data type called “Weather” that keeps track of the temperature of the last 7 days and the average. Assume that the days are numbered 0 to 6 (you can declare an array such as day[7]). When an object of Weather is instantiated, the temperature value of the last 6 days should be automatically initialized to 50.75. Once the program starts running, the user should be able to input the temperature values one day at a time. After each input adjust your array index and values, and update the average. At any time, the user may want to see the temperature of last 7 days and the average. The user may also want to see the temperature of a specific day in the last 7 days. Use constructor and destructor. Be user-friendly. Guide the user by specifying what input is expected. You should ALSO support the following features: (1) Use const keyword everywhere it is appropriate (2) Provide multiple versions of constructors (3) Support a copy constructor (4) Support an overloaded assignment operator (=) (5) Support a feature to find number of current Weather objects. You should use the static keyword where appropriate. (6) Support a reset function that will reset the weather values of all the days to the default value of 50.75. (7) Support a function to compute the median of the last 7 days. (8) Support a function to compute the mode of each weather value

Solution

import java.util.*;

public class Temperature {

    public static void main(String[] args) {

        Scanner console = new Scanner(System.in);

          System.out.print(\"How many days\' temperatures? \");

        int days = console.nextInt( );

             int[ ] temps = new int[days];

       for (int i = 0; i < temps.length; i++) {

            System.out.print(\"Day \" + i + \"\'s high temp: \");

            temps[i] = console.nextInt( );

        }

       int sum = 0;

        for (int i = 0; i < temps.length; i++) {

            sum += temps[i];

        }

        double average = (double) sum / temps.length;

        System.out.println(\"Average temp = \" + average);

        int count = 0;

        for (int i = 0; i < temps.length; i++) {

            if (temps[i] > average) {

                count++;

            }

        }

        System.out.println(count + \" days were above average\");

    }

}

using c++ language,Design an abstract data type called “Weather” that keeps track of the temperature of the last 7 days and the average. Assume that the days ar
using c++ language,Design an abstract data type called “Weather” that keeps track of the temperature of the last 7 days and the average. Assume that the days ar

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site