Jump to content


Check out our Community Blogs



Recent Status Updates

View All Updates

Developed by TechBiz Xccelerator
Photo
- - - - -

how to calculate in kilowatts

string requesturl = “http://f

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 Priceless90

Priceless90

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 19 April 2015 - 02:39 AM

Takes as an input: 
(1)Weather data, which is used as a basis for calculating the energy consumption 
(2)Energy ratings and their impact on energy consumption 
Data entered by user: 
(3)Amount of cubic meters (m3) of building and the energy class of the building 
(4) Date, 
(5) City (from pull-down menu) 
(6)Result: The program calculates the building's energy consumption in kilowatt hours
 
 
This is what I have done so far and i it cannot build,but shows me error
 
string city = null;

Console.WriteLine(“=============================================”);
                      Console.WriteLine(“\tusing world weather online.com”);
                      Console.WriteLine(“=============================================”);
                      Console.Write(“Enter a city to get the forcast:”);
                      city = Console.ReadLine();
                      Console.WriteLine(“=============================================”);
                      string requestUrl = “http://free.worldweatheronline.com/feed/weather.ashx?q=”+ city + “&format=xml&num_of_days=2&key=”;here
                      WebClient webClient = new WebClient();
                      Stream xmlData = webClient.OpenRead(requestUrl);
                      StreamReader streamReader = new StreamReader(xmlData);
                      processXmlData(streamReader);


                      Console.ReadKey();
         }


private static void getcity()
{
  throw new NotImplementedException();
}


         static void processXmlData(StreamReader xmlData)
         {
         string choice = “n”;
         try
        {
        string xmlText = xmlData.ReadToEnd();
        XmlDocument xmlDocument = new XmlDocument();
        xmlDocument.LoadXml(xmlText);
        XmlNodeList xmlNodeList = xmlDocument.SelectNodes(“data/request”);
        foreach (XmlNode xmlNode in xmlNodeList)
        {
        string type = xmlNode[“type”].InnerText;
        string query = xmlNode[“query”].InnerText;
        Console.WriteLine(“Data {0} {1}”, type, query);


        }


        XmlNodeList currentConditionsNodeList = xmlDocument.SelectNodes(“data/current_condition”);
        foreach (XmlNode xmlNode in currentConditionsNodeList)
        {
        string observationTime = xmlNode[“observation_time”].InnerText;
        string tempC = xmlNode[“temp_C”].InnerText;
        string tempF = xmlNode[“temp_F”].InnerText;
        string weatherCode = xmlNode[“weatherCode”].InnerText;
        string weatherIconUrl = xmlNode[“weatherIconUrl”].InnerText;
        string weatherDesc = xmlNode[“weatherDesc”].InnerText;
        string windspeedMiles = xmlNode[“windspeedMiles”].InnerText;
        string windspeedKmph = xmlNode[“windspeedKmph”].InnerText;
        string winddirDegree = xmlNode[“winddirDegree”].InnerText;
        string winddir16Point = xmlNode[“winddir16Point”].InnerText;
        string precipMM = xmlNode[“precipMM”].InnerText;
        string humidity = xmlNode[“humidity”].InnerText;
        string visibility = xmlNode[“visibility”].InnerText;
        string pressure = xmlNode[“pressure”].InnerText;
        string cloudCover = xmlNode[“cloudcover”].InnerText;


        Console.WriteLine(“============================================”);
        Console.WriteLine(“Observation Time     : {0}”, observationTime);
        Console.WriteLine(“Temperature C        : {0}”, tempC);
        Console.WriteLine(“Temperature F        : {0}”, tempF);
        Console.WriteLine(“Weather Code         : {0}”, weatherCode);
        //Console.WriteLine(“Weather Icon         : {0}”, weatherIconUrl);
        Console.WriteLine(“weather Description  : {0}”, weatherDesc);
        Console.WriteLine(“Wind Speed in Miles  : {0}”, windspeedMiles);
        Console.WriteLine(“Wind Speed in KmPH   : {0}”, windspeedKmph);
        Console.WriteLine(“Wind Degree          : {0}”, winddirDegree);
        Console.WriteLine(“Wind Direction       : {0}”, winddir16Point);
        Console.WriteLine(“Precipitation        : {0}”, precipMM);
        Console.WriteLine(“Humidity             : {0}”, humidity);
        Console.WriteLine(“Visibility           : {0}”, visibility);
        Console.WriteLine(“Pressure             : {0}”, pressure);

 


Edited by dargueta, 22 April 2015 - 11:17 AM.


#2 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts

Posted 20 April 2015 - 04:38 AM

What's your question?


Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/