الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

ممكن تساعدونى فى البرنامج المعقد دة....انا عضوة جديدة معاكو

بدأه pre-programer في 4 نوفمبر 2008 · 6 رد · 815 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

بســم الله الـرحمــن الرحيــم :wub:

انا عضوة جديدة معاكوا ومحتاجة مساعدة ضرورى باقرب وقت فى البرنامج المعقد دة

:wacko:

One of the methods of prediction/approximation is the use of least squares fitting using a linear or polynomial function. You are required to write a Java program that does the following:

1. Read in an SGML/XML file that provides a problem definition that includes the type of least squares fitting method, the training data and test data. The file should have the following format:

<problem>

<fit>FitType</fit>

<train>

<point>

<x>xVal</x>

<y>yVal</y>

</point>

…

…

<point>

<x>xVal</x>

<y>yVal</y>

</point>

</train>

<test>

<point>

<x>xVal</x>

<y>yVal</y>

</point>

…

…

<point>

<x>xVal</x>

<y>yVal</y>

</point>

</test>

</problem>

Where FitType Î {LIN, POLY} and xVal and yVal are coordinates of data points. If FitType = POLY, an additional tag after <fit>FitType</fit> will be added to the XML file to specify the degree of polynomial fitting. The tag and its value will have the following format <degree>degree_of_polynomial</degree>

2. Compute the coefficients for the required least squares fitting.

3. Compute the error in floating point notation (a.aaaa Exx) for the training set. Print error in the following format:

Training Set Error:tErrorVal

4. Compute the error in floating point notation (a.aaaa Exx) for the test set. Print error in the following format:

Test Set Error:tErrorVal

تم تعديل هذه المشاركة بواسطة pre-programer في 4 نوفمبر 2008 في 20:26

#2

حياك الله ،

لكن ضع سؤال واضح باللغه العربيه + ضع محاولاتك في الحل ..

واستخدم خاصيه التنسيق في الكود .

بالتوفيق ،

http://informatic-ar.com منصة تعليمية عربية في علوم الحاسب والبرمجة

https://moalfat.com  للكتب الالكترونية والكورسات التعليمية

Everything we see now is just an engineering solution based on old science

#3
Wajdy Essam كتب:

حياك الله ،

لكن ضع سؤال واضح باللغه العربيه + ضع محاولاتك في الحل ..

واستخدم خاصيه التنسيق في الكود .

بالتوفيق ،

السلام عليكم

هو السؤال كلة معبر عن مضمونة بالانجليزى......انا للاسف كودى مش كامل لانى محتاجة اعرف

how to parse XML files

ودى مشكلتى فى الكود

شكرا لمستاعدتكم ليا....جزاكم الله كل خير

#4

ابحثي في المنتدى

ستجدي مواضيع تتحدث عن parse xml

تحياتي

حزمة المحرك الإصدارة 0.8

أي أحد يجد أني ظلمته فليراسلني

وبإذن الله لو كان له حق سيأخذه

728x90.png

#5

سلام

ممكن تستخدمي ال Simple API for XML

هذا اللينك فية شرح لل API

http://www.saxproject.org/quickstart.html

#6

السلام عليكــم ورحمـة الله وبركاتــة

شكرا لكل من قدم المساعدة ليا وان شاء الله سوف ابحث واطلعكم بالنتيجة اذا احتاجت الى بعد الاستفسارات

#7

السلام عليكــم ورحمـة الله وبركاتــة

now ana 3mlt t2reebn el code but i have aproblem in reading >>>>>i'll show u the input file and my parse coding

the input file wille be for example:

- <problem>

<fit>LIN</fit>

- <train>

- <point>

<x>97.0</x>

<y>12.5</y>

</point>

- <point>

<x>93.0</x>

<y>12.5</y>

</point>

- <point>

<x>88.0</x>

<y>8.0</y>

</point>

- <point>

<x>81.0</x>

<y>9.5</y>

</point>

- <point>

<x>75.0</x>

<y>16.5</y>

</point>

- <point>

<x>57.0</x>

<y>11.0</y>

</point>

</train>

- <test>

- <point>

<x>82.0</x>

<y>11.5</y>

</point>

- <point>

<x>95.0</x>

<y>19.0</y>

</point>

- <point>

<x>88.0</x>

<y>16.0</y>

</point>

- <point>

<x>75.0</x>

<y>11.5</y>

</point>

- <point>

<x>72.0</x>

<y>11.0</y>

</point>

- <point>

<x>91.0</x>

<y>13.0</y>

</point>

</test>

</problem>

***********************************************

explaination for input file:

Where"<fit>LIN</fit> " is FitType hayb2a ama da aw da {LIN, POLY} ema Liner or Polynomial and xVal and yVal are coordinates of data points. fe 7alet law el FitType da = POLY, ha3ml tag after <fit>FitType</fit> "miss i my code!!???" will be added "<degree>degree_of_polynomial</degree>" to the XML file to specify the degree of polynomial fitting. The tag and its value will have the last format

***************************************************

my pretty code :blush: :

package parse;
///import Java.matrix;
import java.io.IOException;
import java.util.ArrayList;
import javax.xml.parsers.*;
import org.xml.sax.SAXException;
import org.w3c.dom.*;
public class ParsingXML {

 public static void main(String[] args) {

  if(args.length == 0)
  {
   System.out.println("ERROR");
   System.exit(0);
  }
  DocumentBuilder db = null;
  ArrayList<Integer> arX = new ArrayList<Integer>();
  ArrayList<Integer> arY = new ArrayList<Integer>();
  //ArrayList<Integer> arZ = new ArrayList<Integer>();

  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

  try {
   db = factory.newDocumentBuilder();
  } catch (ParserConfigurationException e) {
   e.printStackTrace();
  }
  Document doc = null;

  try {
   doc = db.parse(args[0]);
  } catch (SAXException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  Element docEle = doc.getDocumentElement();  // interface element
  NodeList nlPoints= docEle.getElementsByTagName("point");

  NodeList nlx = null;
  NodeList nly = null;
  //NodeList nlz = null;

  for (int i = 0; i < nlPoints.getLength(); i++) {
   Node np1 =  nlPoints.item(i);
   Element e = (Element)np1;
	nlx = e.getElementsByTagName("x");
	nly = e.getElementsByTagName("y");
   // nlz = e.getElementsByTagName("z");
	if(nlx.getLength() ==1&& nly.getLength() ==1)
	{
	 org.w3c.dom.Node nx = nlx.item(0);
	 Element ex =(Element) nx;
	 String sValuex = ex.getFirstChild().getNodeValue();
	 arX.add(Integer.parseInt(sValuex));


	 org.w3c.dom.Node ny = nly.item(0);
	 Element ey =(Element) ny; 
	 String sValuey = ey.getFirstChild().getNodeValue();
	 arY.add(Integer.parseInt(sValuey));


	/* org.w3c.dom.Node nz = nlz.item(0);
	 Element ez =(Element) nz; 
	 String sValuez = ez.getFirstChild().getNodeValue();
	 arZ.add(Integer.parseInt(sValuez));*/

	}


  }
  System.out.println(arX);
  System.out.println(arY);
  //System.out.println(arZ);


 }

}

plz any 1 help me if it possible.......Great ThanX

تم تعديل هذه المشاركة بواسطة pre-programer في 7 نوفمبر 2008 في 18:35

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…